Merge pull request #591 from echo-gravitas/echo-gravitas/issue-586 #7
This file contains hidden or 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: Self Assign Issue | ||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| jobs: | ||
| self-assign: | ||
| if: github.repository == 'accius/openhamclock' | ||
| runs-on: ubuntu-latest | ||
| # Only trigger on '/assign' comments on issues (not PRs) | ||
| steps: | ||
| - name: Assign commenter to issue | ||
| if: | | ||
| github.event.comment.body == '/assign' && | ||
| github.event.issue.pull_request == null | ||
| uses: actions/github-script@v7 | ||
| permissions: | ||
| issues: write | ||
| with: | ||
| script: | | ||
| const { actor } = context; | ||
| const issueNumber = context.issue.number; | ||
| // Assign the commenter | ||
| await github.rest.issues.addAssignees({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: issueNumber, | ||
| assignees: [actor] | ||
| }); | ||
| // React with 👍 so they know it worked | ||
| await github.rest.reactions.createForIssueComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: context.payload.comment.id, | ||
| content: '+1' | ||
| }); | ||
| console.log(`Assigned ${actor} to issue #${issueNumber}`); | ||