Skip to content

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SamuelFialka
Copy link

@SamuelFialka SamuelFialka commented Jun 25, 2025

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:

  • Skips pull requests and issues labeled as to-be-discussed
  • Automatically closes issues labeled awaiting-response or those without assignees after 90+ days of inactivity
  • Sends a reminder comment on assigned issues that have been inactive for over 90 days (without re-sending it more than once a week)
  • Avoids duplicate comments and respects special labels

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)

@SamuelFialka SamuelFialka requested a review from lucasssvaz as a code owner June 25, 2025 11:32
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


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.

Copy link
Contributor

github-actions bot commented Jun 25, 2025

Messages
📖 🎉 Good Job! All checks are passing!

👋 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 ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 8a17a91

@lucasssvaz lucasssvaz requested a review from Copilot June 25, 2025 12:28
Copy link
Contributor

@Copilot Copilot AI left a 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.

Comment on lines +92 to +101
if (recentFriendlyReminder) {
totalSkipped++;
continue;
}

if (issue.labels.some(label => exemptLabels.includes(label.name))) {
totalSkipped++;
continue;
}

Copy link
Preview

Copilot AI Jun 25, 2025

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.

Suggested change
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.

Copy link
Author

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucasssvaz wdyt?

Comment on lines +80 to +85
const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
issue_number: issue.number,
per_page: 10,
});
Copy link
Preview

Copilot AI Jun 25, 2025

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.

Suggested change
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.

Copy link
Author

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucasssvaz wdyt?

Copy link
Collaborator

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.

@P-R-O-C-H-Y P-R-O-C-H-Y added the Status: Review needed Issue or PR is awaiting review label Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review needed Issue or PR is awaiting review Type: CI & Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants