-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (57 loc) · 1.92 KB
/
dsm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: DSM
on:
schedule:
# every day at 4:00 UTC (7:00 MSK)
- cron: '0 4 * * *'
workflow_dispatch:
jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Read template
id: template
uses: juliangruber/read-file-action@v1
with:
path: ./.github/ISSUE_TEMPLATE/dsm.md
- name: Echo package.json
run: echo ${{ steps.package.outputs.content }}
- uses: actions/github-script@v3
with:
github-token: ${{ secrets.DSM_TOKEN }}
script: |
const organization = 'atls-academy'
const team_slugs = ['Cadets']
const body = function(){/*${{ steps.template.outputs.content }}*/}.toString()
const opts = github.issues.listForRepo.endpoint.merge({
...context.issue,
labels: ['Type: DSM'],
state: 'open'
})
const members = []
for (const team_slug of team_slugs) {
const teams_response = await github.request("GET /orgs/{org}/teams/{team_slug}/members", {
team_slug: team_slug,
org: organization
})
for (const member of teams_response['data']) {
members.push(member['login'])
}
}
const issues = await github.paginate(opts)
for (const issue of issues) {
github.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed'
})
}
github.issues.create({
title: '[DSM] ' + new Date().toDateString(),
owner: context.repo.owner,
repo: context.repo.repo,
assignees: members,
labels: ['Type: DSM'],
body: body.slice(13,-3)
})