Bugfix/batch logic #97
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-or-Unassign-Issue | |
# Ref: https://docs.github.com/en/rest/issues/assignees#about-the-issue-assignees-api | |
# Ref: https://docs.github.com/en/actions/using-workflows/about-workflows | |
# Ref permissions: https://docs.github.com/en/actions/security-guides/automatic-token-authentication | |
on: | |
issue_comment: | |
types: created | |
permissions: | |
issues: write | |
jobs: | |
issue_assign_job: | |
runs-on: ubuntu-latest | |
steps: | |
# This job only runs for issue comments. | |
- if: github.event.comment.body == 'take' && !github.event.issue.pull_request | |
run: | | |
echo "Assigning issue ${{ github.event.issue.number }} to ${{ github.event.comment.user.login }}" | |
curl \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-d '{"assignees": ["${{ github.event.comment.user.login }}"]}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees | |
# This job only runs for issue comments. | |
- if: github.event.comment.body == 'remove' && !github.event.issue.pull_request | |
run: | | |
echo "Unassigning issue ${{ github.event.issue.number }} from ${{ github.event.comment.user.login }}" | |
curl \ | |
-X DELETE \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-d '{"assignees": ["${{ github.event.comment.user.login }}"]}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees |