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