Skip to content

Label Old Bugs

Label Old Bugs #334

Workflow file for this run

#
# auto-label.yml
# - Find all open issues without a label and a title containing "[BUG]".
# - Apply the label "Bug: Potential ?" to these issues.
#
name: Label Old Bugs
on:
schedule:
- cron: "30 8 * * *"
jobs:
autolabel:
name: Auto Label
if: github.repository == 'MarlinFirmware/Marlin'
runs-on: ubuntu-22.04
steps:
- name: Auto Label for [BUG]
uses: actions/github-script@v7
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 issues without labels that have a title containing '[BUG]'.
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)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['Bug: Potential ?']
});
}