Blame Raw
Cohee · b06a6295 · · 161 lines (6.4 KB)
1 contributor
1name: 🛠️ Issues Manager
2
3on:
4 issues:
5 types: [opened, edited, labeled, unlabeled]
6 # Re also listen to comments, to remove stale labels right away
7 issue_comment:
8 types: [created]
9
10permissions:
11 contents: read
12 issues: write
13
14jobs:
15 label-on-content:
16 name: 🏷️ Label Issues by Content
17 runs-on: ubuntu-latest
18 if: always()
19
20 steps:
21 - name: Mint App Token
22 id: app
23 # Create a GitHub App token
24 # https://github.com/marketplace/actions/create-github-app-token
25 uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
26 with:
27 app-id: ${{ vars.ST_BOT_APP_ID }}
28 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
29 owner: ${{ github.repository_owner }}
30
31 - name: Checkout Repository
32 # Checkout
33 # https://github.com/marketplace/actions/checkout
34 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35
36 - name: Auto-Label Issues (Based on Issue Content)
37 # only auto label based on issue content once, on open (to prevent re-labeling removed labels)
38 if: github.event.action == 'opened'
39
40 # Issue Labeler
41 # https://github.com/marketplace/actions/regex-issue-labeler
42 uses: github/issue-labeler@c1b0f9f52a63158c4adc09425e858e87b32e9685 # v3.4
43 with:
44 configuration-path: .github/issues-auto-labels.yml
45 enable-versioned-regex: 0
46 repo-token: ${{ steps.app.outputs.token }}
47
48 label-on-labels:
49 name: 🏷️ Label Issues by Labels
50 needs: [label-on-content]
51 runs-on: ubuntu-latest
52 if: always()
53
54 steps:
55 - name: Mint App Token
56 id: app
57 # Create a GitHub App token
58 # https://github.com/marketplace/actions/create-github-app-token
59 uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
60 with:
61 app-id: ${{ vars.ST_BOT_APP_ID }}
62 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
63 owner: ${{ github.repository_owner }}
64
65 - name: ✅ Add "👍 Approved" for relevant labels
66 if: contains(fromJSON('["👩‍💻 Good First Issue", "🙏 Help Wanted", "🪲 Confirmed", "⚠️ High Priority", "❕ Medium Priority", "💤 Low Priority"]'), github.event.label.name)
67 # 🤖 Issues Helper
68 # https://github.com/marketplace/actions/issues-helper
69 uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
70 with:
71 actions: 'add-labels'
72 token: ${{ steps.app.outputs.token }}
73 labels: '👍 Approved'
74
75 - name: ❌ Remove progress labels when issue is marked done or stale
76 if: contains(fromJSON('["✅ Done", "✅ Done (staging)", "⚰️ Stale", "❌ wontfix"]'), github.event.label.name)
77 # 🤖 Issues Helper
78 # https://github.com/marketplace/actions/issues-helper
79 uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
80 with:
81 actions: 'remove-labels'
82 token: ${{ steps.app.outputs.token }}
83 labels: '🧑‍💻 In Progress,🤔 Unsure,🤔 Under Consideration'
84
85 - name: ❌ Remove temporary labels when confirmed labels are added
86 if: contains(fromJSON('["❌ wontfix","👍 Approved","👩‍💻 Good First Issue"]'), github.event.label.name)
87 # 🤖 Issues Helper
88 # https://github.com/marketplace/actions/issues-helper
89 uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
90 with:
91 actions: 'remove-labels'
92 token: ${{ steps.app.outputs.token }}
93 labels: '🤔 Unsure,🤔 Under Consideration'
94
95 - name: ❌ Remove no bug labels when "🪲 Confirmed" is added
96 if: github.event.label.name == '🪲 Confirmed'
97 # 🤖 Issues Helper
98 # https://github.com/marketplace/actions/issues-helper
99 uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
100 with:
101 actions: 'remove-labels'
102 token: ${{ steps.app.outputs.token }}
103 labels: '✖️ Not Reproducible,✖️ Not A Bug'
104
105 remove-stale-label:
106 name: 🗑️ Remove Stale Label on Comment
107 needs: [label-on-content, label-on-labels]
108 runs-on: ubuntu-latest
109 # Only run this on new comments, to automatically remove the stale label
110 if: always() && (github.event_name == 'issue_comment' && github.event.sender.type != 'Bot')
111
112 steps:
113 - name: Mint App Token
114 id: app
115 # Create a GitHub App token
116 # https://github.com/marketplace/actions/create-github-app-token
117 uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
118 with:
119 app-id: ${{ vars.ST_BOT_APP_ID }}
120 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
121 owner: ${{ github.repository_owner }}
122
123 - name: Remove Stale Label
124 # 🤖 Issues Helper
125 # https://github.com/marketplace/actions/issues-helper
126 uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3.6.0
127 with:
128 actions: 'remove-labels'
129 token: ${{ steps.app.outputs.token }}
130 issue-number: ${{ github.event.issue.number }}
131 labels: '⚰️ Stale,🕸️ Inactive,🚏 Awaiting User Response,🛑 No Response'
132
133 write-auto-comments:
134 name: 💬 Post Issue Comments Based on Labels
135 needs: [label-on-content, label-on-labels, remove-stale-label]
136 runs-on: ubuntu-latest
137 if: always()
138
139 steps:
140 - name: Mint App Token
141 id: app
142 # Create a GitHub App token
143 # https://github.com/marketplace/actions/create-github-app-token
144 uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
145 with:
146 app-id: ${{ vars.ST_BOT_APP_ID }}
147 private-key: ${{ secrets.ST_BOT_PRIVATE_KEY }}
148 owner: ${{ github.repository_owner }}
149
150 - name: Checkout Repository
151 # Checkout
152 # https://github.com/marketplace/actions/checkout
153 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
154
155 - name: Post Issue Comments Based on Labels
156 # Label Commenter
157 # https://github.com/marketplace/actions/label-commenter
158 uses: peaceiris/actions-label-commenter@f0dbbef043eb1b150b566db36b0bdc8b7f505579 # v1.10.0
159 with:
160 config_file: .github/issues-auto-comments.yml
161 github_token: ${{ steps.app.outputs.token }}