1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-02 16:59:03 +00:00
MarlinFirmware/.github/workflows/auto-label.yml

42 lines
1.2 KiB
YAML
Raw Normal View History

2023-11-29 22:45:37 +00:00
#
# 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
2023-11-29 22:45:37 +00:00
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]
2023-12-03 06:32:28 +00:00
uses: actions/github-script@v7
2023-11-29 22:45:37 +00:00
with:
script: |
2023-12-03 07:22:14 +00:00
// Get all open issues in this repository
2023-11-29 22:45:37 +00:00
const issueList = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
2023-12-03 07:22:14 +00:00
// Filter issues without labels that have a title containing '[BUG]'.
2023-11-29 22:45:37 +00:00
const matchingIssues = issueList.data.filter(
issue => issue.title.includes('[BUG]') && issue.labels.length === 0
);
2023-12-03 07:22:14 +00:00
// Process the first 50
2023-11-29 22:45:37 +00:00
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 ?']
});
}