Skip to content

Commit 95821b0

Browse files
committed
✅ Auto-label older open [BUG] issues
1 parent d62ee95 commit 95821b0

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

.github/workflows/auto-label.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# auto-label.yml
3+
# - Find all open issues without a label and a title containing "[BUG]".
4+
# - Apply the label "Bug: Potential ?" to these issues.
5+
#
6+
7+
on:
8+
schedule:
9+
- cron: "30 8 * * *"
10+
11+
jobs:
12+
autolabel:
13+
name: Auto Label
14+
if: github.repository == 'MarlinFirmware/Marlin'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Auto Label for [BUG]
18+
uses: actions/github-script@v5
19+
with:
20+
script: |
21+
# Get all open issues in this repository
22+
const issueList = await github.rest.issues.listForRepo({
23+
owner: context.repo.owner,
24+
repo: context.repo.repo,
25+
state: 'open'
26+
});
27+
# Filter the list of issues to only those that don't have any labels
28+
# and have a title that contains '[BUG]'. Only the first 50 issues.
29+
const matchingIssues = issueList.data.filter(
30+
issue => issue.title.includes('[BUG]') && issue.labels.length === 0
31+
);
32+
# Process the first 50
33+
for (const issue of matchingIssues.slice(0, 50)) {
34+
// Run the desired action on the issue
35+
// For example, to add a label:
36+
await github.rest.issues.addLabels({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
issue_number: issue.number,
40+
labels: ['Bug: Potential ?']
41+
});
42+
}

.github/workflows/close-stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
steps:
20-
- uses: actions/stale@v3
20+
- uses: actions/stale@v8
2121
with:
2222
repo-token: ${{ secrets.GITHUB_TOKEN }}
2323
stale-issue-message: |

0 commit comments

Comments
 (0)