-
Notifications
You must be signed in to change notification settings - Fork 7.6k
feat(workflow): Backlog management bot #11518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Samuel Fialka seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
👋 Hello SamuelFialka, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an automated GitHub Action workflow and supporting script to manage stale issues by closing or reminding based on labels and inactivity thresholds.
- Introduces a daily-scheduled workflow (
backlog-bot.yml
) that checks open issues and invokes the cleanup script. - Implements
backlog-cleanup.js
to fetch issues, skip exempt ones, close or comment on stale issues, and avoid duplicate reminders. - Tracks and logs totals for closed issues, sent reminders, and skipped items.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
.github/workflows/backlog-bot.yml | New workflow to schedule and run the backlog cleanup. |
.github/scripts/backlog-cleanup.js | Script implementing issue fetching, closing, and reminders. |
if (recentFriendlyReminder) { | ||
totalSkipped++; | ||
continue; | ||
} | ||
|
||
if (issue.labels.some(label => exemptLabels.includes(label.name))) { | ||
totalSkipped++; | ||
continue; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The early check for recentFriendlyReminder at line 92 prevents the automatic closure path from running when a reminder was recently posted. To ensure stale issues labeled for closure still get closed, move this check inside the reminder-sending branch so that only reminder logic is gated by recent comments.
if (recentFriendlyReminder) { | |
totalSkipped++; | |
continue; | |
} | |
if (issue.labels.some(label => exemptLabels.includes(label.name))) { | |
totalSkipped++; | |
continue; | |
} | |
if (issue.labels.some(label => exemptLabels.includes(label.name))) { | |
totalSkipped++; | |
continue; | |
} | |
if (shouldSendReminder(issue, exemptLabels, closeLabels)) { | |
if (!recentFriendlyReminder) { | |
await github.rest.issues.createComment({ | |
owner, | |
repo, | |
issue_number: issue.number, | |
body: '⏰ Friendly Reminder: This issue has been inactive for a while. Please update or it may be closed.', | |
}); | |
totalReminders++; | |
} | |
} |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The originally proposed solution would ensure a early exit + it increments totalSkipped used for final summary at logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasssvaz wdyt?
const { data: comments } = await github.rest.issues.listComments({ | ||
owner, | ||
repo, | ||
issue_number: issue.number, | ||
per_page: 10, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limiting comment retrieval to 10 may miss recent reminders if an issue has many comments. Consider increasing per_page
to 100 or implementing pagination so all comments within the last 7 days are checked.
const { data: comments } = await github.rest.issues.listComments({ | |
owner, | |
repo, | |
issue_number: issue.number, | |
per_page: 10, | |
}); | |
let comments = []; | |
let page = 1; | |
let fetchedComments; | |
do { | |
const { data } = await github.rest.issues.listComments({ | |
owner, | |
repo, | |
issue_number: issue.number, | |
per_page: 100, | |
page, | |
}); | |
fetchedComments = data; | |
comments = comments.concat(fetchedComments); | |
page++; | |
} while (fetchedComments.length === 100); |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there would be more than 10 comments, it is a sign that the issue is being worked on. In that case, the issue will be skipped because the 90 days of inactivity condition will not be met.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucasssvaz wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will review this PR in a few days. For now testing the new BLE related stuff before 3.3.0 RC1. Will review ASAP.
Description of Change
This PR introduces a GitHub Action workflow that helps manage stale issues in the repository.
The bot runs daily and performs the following tasks:
The purpose of this automation is to keep the issue backlog clean, manageable, and up-to-date.
Feel free to suggest adjustments to label logic, thresholds, or wording in comments.
Tests scenarios
The script and workflow were successfully tested on GitHub Issues in my own fork. Behavior such as issue closure and reminder comments worked as expected.
Related links
Please provide links to related issue, PRs etc.
(eg. Closes #number of issue)