Skip to content

Commit f12482a

Browse files
committed
Fix stale issues workflow
1 parent cddfb4e commit f12482a

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

.github/workflows/stale.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
issue_comment:
88
types: ["created"]
99

10+
env:
11+
# Name of the label that makes issues subject to the stale bot.
12+
STALE_ENABLE_LABEL: "status: waiting for information"
13+
# Name of the label used to mark issues as stale.
14+
STALE_LABEL: "status: stale"
15+
1016
jobs:
1117
stale-bot:
1218
runs-on: ubuntu-latest
@@ -17,11 +23,11 @@ jobs:
1723
with:
1824
github-token: ${{github.token}}
1925
script: |
20-
// Get a list of all open issues labeled `waiting for feedback`
26+
// Get a list of all open issues labeled as waiting for feedback
2127
const opts = github.issues.listForRepo.endpoint.merge({
2228
...context.repo,
2329
state: 'open',
24-
labels: ['waiting for feedback'],
30+
labels: ['${{ env.STALE_ENABLE_LABEL }}'],
2531
});
2632
const issues = await github.paginate(opts);
2733
@@ -41,7 +47,7 @@ jobs:
4147
github.issues.addLabels({
4248
...context.repo,
4349
issue_number: issue.number,
44-
labels: ['stale']
50+
labels: ['${{ env.STALE_LABEL }}']
4551
});
4652
}
4753
@@ -52,7 +58,7 @@ jobs:
5258
github-token: ${{github.token}}
5359
script: |
5460
// Every time a comment is added to an issue, close it if it contains
55-
// the `stale` label.
61+
// the stale label.
5662
5763
// Load issue's labels.
5864
const opts = github.issues.listLabelsOnIssue.endpoint.merge({
@@ -61,13 +67,13 @@ jobs:
6167
});
6268
const labels = await github.paginate(opts);
6369
64-
// Search for `stale`.
70+
// Search for stale label.
6571
for (const label of labels) {
66-
if (label.name === 'stale') {
72+
if (label.name === '${{ env.STALE_LABEL }}') {
6773
await github.issues.removeLabel({
6874
...context.repo,
6975
issue_number: context.issue.number,
70-
name: 'stale'
76+
name: '${{ env.STALE_LABEL }}'
7177
})
7278
return;
7379
}
@@ -79,11 +85,11 @@ jobs:
7985
with:
8086
github-token: ${{github.token}}
8187
script: |
82-
// Load all the `stale` issues
88+
// Load all the stale issues
8389
const opts = github.issues.listForRepo.endpoint.merge({
8490
...context.repo,
8591
state: 'open',
86-
labels: ['stale'],
92+
labels: ['${{ env.STALE_LABEL }}'],
8793
});
8894
const issues = await github.paginate(opts);
8995

0 commit comments

Comments
 (0)