3Sum #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DSA Issue Management | |
on: | |
issues: | |
types: [opened, edited, closed] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Label issues | |
uses: actions/labeler@v4 | |
with: | |
configuration_path: .github/labels.yml | |
- name: Assign issues | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.issues.update({ | |
issue_number: context.issue.number, | |
assignees: ['assignee1', 'assignee2'] | |
}) | |
- name: Notify assignees | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
body: '@assignee1, @assignee2, you have been assigned this issue.' | |
}) | |
- name: Close duplicate issues | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const duplicates = await github.issues.listForRepo({ | |
repository: context.repo.name, | |
issue_number: context.issue.number, | |
duplicates: true | |
}) | |
duplicates.forEach(async (duplicate) => { | |
await github.issues.update({ | |
issue_number: duplicate.issue_number, | |
state: 'closed' | |
}) | |
}) |