diff --git a/.github/workflows/commentCommands.yml b/.github/workflows/commentCommands.yml new file mode 100644 index 0000000..6344344 --- /dev/null +++ b/.github/workflows/commentCommands.yml @@ -0,0 +1,39 @@ +name: commentCommands + +on: + issue_comment: + types: created + +jobs: + + assign-commentor: + runs-on: ubuntu-latest + if: | + contains(github.event.comment.body, '/assignme') || + contains(github.event.comment.body, '/assign me') + steps: + - name: Assigning to commenter + run: | + curl \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees \ + -d '{"assignees":["${{ github.event.comment.user.login }}"]}' + + add-label-duplicate: + runs-on: ubuntu-latest + if: | + contains(github.event.comment.body, '/duplicate') && ( + github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'COLLABORATOR' || + github.event.comment.author_association != 'CONTRIBUTOR' ) + steps: + - name: add-label-duplicate + run: | + curl \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels \ + -d '{"labels":["duplicate"]}'