Skip to content

DSM

DSM #787

Workflow file for this run

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)
})