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: 'Assign Issue on Keyword' | |
on: | |
issue_comment: | |
types: [created] | |
permissions: | |
issues: write # Ensures the workflow can write to issues | |
pull-requests: write # Ensures the workflow can write to pull requests | |
jobs: | |
assign_issue: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for keyword | |
if: contains(github.event.comment.body, 'ASSIGN_ME') | |
run: echo "Keyword found, proceeding to assign..." | |
- name: Comment on the issue | |
if: contains(github.event.comment.body, 'ASSIGN_ME') | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
await github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Thanks for taking on this issue', | |
}); | |
- name: Assign issue | |
if: contains(github.event.comment.body, 'ASSIGN_ME') | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
await github.issues.addAssignees({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
assignees: [context.actor] | |
}); |