-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f998b46
commit 3c1e2da
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Duplicate Issue Checker | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
|
||
permissions: | ||
issues: write | ||
contents: read | ||
|
||
jobs: | ||
check_duplicates: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check for Duplicates | ||
uses: actions/issue-labeler@v1 | ||
id: duplicate_check | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
config-path: .github/duplicate-issue-config.yml | ||
|
||
- name: Close and Comment on Duplicate | ||
if: steps.duplicate_check.outputs.is_duplicate == 'true' | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const issue_number = context.payload.issue.number; | ||
const duplicate_issue_number = steps.duplicate_check.outputs.duplicate_issue_number; | ||
await github.rest.issues.update({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue_number, | ||
state: 'closed' | ||
}); | ||
await github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue_number, | ||
body: `This issue appears to be a duplicate of #${duplicate_issue_number}. Please follow updates on the original issue.` | ||
}); |