issues-pinner.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #
  2. # This workflow adds a label to the issue involved on event when is pinned
  3. # and removes it when unpinned.
  4. #
  5. # It also is enhanced with `stale.yml` workflow: pinned issues never stales
  6. # because that label is declared as part of it `exempt-issue-labels`
  7. # input parameter.
  8. #
  9. name: Issues pinner management
  10. on:
  11. issues:
  12. types:
  13. - "pinned"
  14. - "unpinned"
  15. permissions:
  16. # no checkouts/branching needed
  17. contents: none
  18. # needed by "action-add-labels / action-remove-labels" to CRUD labels
  19. issues: write
  20. # This allows a subsequently queued workflow run to interrupt/wait for previous runs
  21. concurrency:
  22. group: '${{ github.workflow }} @ ${{ github.event.issue.number || github.run_id }}'
  23. cancel-in-progress: false # true: interrupt, false = wait for
  24. jobs:
  25. labeler:
  26. name: Pushpin labeler
  27. runs-on: ubuntu-latest
  28. steps:
  29. - name: Add pushpin label on pinning an issue
  30. id: if-pinned
  31. if: github.event.action == 'pinned'
  32. uses: actions-ecosystem/action-add-labels@v1
  33. with:
  34. repo: ${{ github.repository }}
  35. number: ${{ github.event.issue.number }}
  36. labels: |
  37. :pushpin: pinned
  38. - name: Remove pushpin label on unpinning an issue
  39. id: if-unpinned
  40. if: github.event.action == 'unpinned'
  41. uses: actions-ecosystem/action-remove-labels@v1
  42. with:
  43. repo: ${{ github.repository }}
  44. number: ${{ github.event.issue.number }}
  45. labels: |
  46. :pushpin: pinned
  47. - name: GitHub reporter
  48. # run even previous steps fails
  49. if: always()
  50. run: |
  51. echo "$INPUT_SUMMARY" >> $GITHUB_STEP_SUMMARY;
  52. env:
  53. INPUT_SUMMARY: ${{ format('Issue [\#{2}]({0}/{1}/issues/{2}) should be `{3}`.',
  54. github.server_url, github.repository,
  55. github.event.issue.number,
  56. github.event.action) }}