Skip to content
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

chore: a stalebot to close inactive issues and PRs #29134

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions .github/stale.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/manage-stale-issues-and-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Manage stale issues and PRs"
on:
# Chosen to be just before London wakes up and way past San Francisco's bedtime.
schedule:
- cron: "0 8 * * 1-5" # This is in UTC.
Comment on lines +3 to +5
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If emails are to be sent at all, I figured it best to send them when as few people as possible are likely to be interrupted/nerdsniped by them.

# Do a dry-run (debug-only: true) whenever this workflow itself is changed.
pull_request:
paths:
- .github/workflows/manage-stale-issues-and-prs.yml
types:
- opened
- synchronize
Comment on lines +6 to +12
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we also run this workflow on pull requests – but only pull requests that change the workflow file itself – we can easily test out tweaks to the config.


permissions:
issues: write
pull-requests: write

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v6
with:
ascending: true # Spend API operations budget on older, more-likely-to-get-closed issues first
close-issue-message: "" # Leave no comment when closing
close-pr-message: "" # Leave no comment when closing
Comment on lines +25 to +26
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel less strongly about this one as I do about stale-issue-message and stale-pr-message. You could make the case that an email should be sent when the thing is ultimately closed. My preference is for the bot to be silent, but deadly.

days-before-issue-stale: 7
days-before-pr-stale: 14
days-before-close: 7
Comment on lines +27 to +29
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was replicated from the old config at .github/stale.yml.

Copy link
Contributor

Choose a reason for hiding this comment

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

It used to be a year before stale-bot marked issues as stale. Here's one example: #16270 and you can see them all at https://github.com/solana-labs/solana/issues?q=is%3Aissue+is%3Aclosed+label%3Astale+

Maybe a year is too much, but let's start with the old configuration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, oops. I didn't see this before landing it. I'll update it!

…let's start with the old configuration

But isn't the deleted stale.yml the old configuration? If not, do you know where to find said old configuration?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

and if I'm reading this right, days-before-pr-stale should probably be 7 to match the old config

edit: oops, apparently GH defaults to "you want to do a review, right?" post merge, so this wasn't submitted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. I was following the recommendation here, which I gave preference over the olde config.

debug-only: ${{ github.event_name == 'pull_request' }} # Dry-run when true.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When running on a PR, the bot logs to the workflow logs without actually taking any actions.

exempt-all-milestones: true # Milestones can sometimes last a month, so exempt issues attached to a milestone.
exempt-issue-labels: blocked,do-not-close,feature-gate,security
exempt-pr-labels: blocked,do-not-close,feature-gate,security
Comment on lines +32 to +33
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are copied from the old .github/stale.yml workflow. I added do-not-close as a way to exempt an issue/PR from stalebot's clutches.

# No actual changes get made in debug-only mode, so we can raise the operations ceiling.
operations-per-run: ${{ github.event_name == 'pull_request' && 100 || 30}}
stale-issue-label: stale
stale-issue-message: "" # Leave no comment when marking as stale
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think becoming stale is a comment-worthy event, nor should it send an email. My position is that stalebot shouldn't be your reminders app; if you think you will need reminding about an open issue, you can set a reminder in a way that makes sense for you.

stale-pr-label: stale
stale-pr-message: "" # Leave no comment when marking as stale
# Time immemorial when in debug-only mode (ie. on pull requests).
# `STALEBOT_START_DATE` otherwise.
# You can use this as a killswitch by setting `STALEBOT_START_DATE` in the far future.
start-date: ${{ github.event_name == 'pull_request' && '1970-01-01T00:00:00Z' || secrets.STALEBOT_START_DATE }} # ISO 8601 or RFC 2822
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a strategy for introducing this thing gradually. I will set myself a reminder to back this off slowly, so that we don't end up with every notification, all at once.