Skip to content

Bugfix/batch logic

Bugfix/batch logic #97

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