Skip to content

Commit

Permalink
✅ Auto-label older open [BUG] issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Nov 29, 2023
1 parent d62ee95 commit 95821b0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# auto-label.yml
# - Find all open issues without a label and a title containing "[BUG]".
# - Apply the label "Bug: Potential ?" to these issues.
#

on:
schedule:
- cron: "30 8 * * *"

jobs:
autolabel:
name: Auto Label
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-latest
steps:
- name: Auto Label for [BUG]
uses: actions/github-script@v5
with:
script: |
# Get all open issues in this repository
const issueList = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
# Filter the list of issues to only those that don't have any labels
# and have a title that contains '[BUG]'. Only the first 50 issues.
const matchingIssues = issueList.data.filter(
issue => issue.title.includes('[BUG]') && issue.labels.length === 0
);
# Process the first 50
for (const issue of matchingIssues.slice(0, 50)) {
// Run the desired action on the issue
// For example, to add a label:
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['Bug: Potential ?']
});
}
2 changes: 1 addition & 1 deletion .github/workflows/close-stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v3
- uses: actions/stale@v8
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: |
Expand Down

0 comments on commit 95821b0

Please sign in to comment.