commentCommands.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. name: commentCommands
  2. on:
  3. issue_comment:
  4. types: created
  5. jobs:
  6. assign-commentor:
  7. runs-on: ubuntu-latest
  8. if: |
  9. contains(github.event.comment.body, '/assignme') ||
  10. contains(github.event.comment.body, '/assign me')
  11. steps:
  12. - name: Assigning to commenter
  13. run: |
  14. curl \
  15. -X POST \
  16. -H "Accept: application/vnd.github+json" \
  17. -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
  18. https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees \
  19. -d '{"assignees":["${{ github.event.comment.user.login }}"]}'
  20. add-label-duplicate:
  21. runs-on: ubuntu-latest
  22. if: |
  23. contains(github.event.comment.body, '/duplicate') && (
  24. github.event.comment.author_association == 'OWNER' ||
  25. github.event.comment.author_association == 'COLLABORATOR' ||
  26. github.event.comment.author_association != 'CONTRIBUTOR' )
  27. steps:
  28. - name: add-label-duplicate
  29. run: |
  30. curl \
  31. -X POST \
  32. -H "Accept: application/vnd.github+json" \
  33. -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
  34. https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels \
  35. -d '{"labels":["duplicate"]}'