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