This is day 8 of my GitHub Actions Advent Calendar. If you want to see the whole list of tips as they're published, see the index.
Having stale issues hanging around your repository can be a big detriment. Having several-year-old issues that you don't intend to ever fix makes it harder to find the important ones that you want to focus on. Open pull requests that you'll never merge makes it look like you're ignoring the project. And all this cruft in the project adds an invisible cognitive weight.
Anybody who's worked in the service industry will understand this problem. It's like a cook's mise en place – the setup at their station in the kitchen with their ingredients.
If you let your mise-en-place run down, get dirty and disorganized, you’ll quickly find yourself spinning in place and calling for backup. I worked with a chef who used to step behind the line to a dirty cook’s station in the middle of a rush to explain why the offending cook was falling behind. He’d press his palm down on the cutting board, which was littered with peppercorns, spattered sauce, bits of parsley, bread crumbs and the usual flotsam and jetsam that accumulates quickly on a station if not constantly wiped away with a moist side towel. "You see this?" he’d inquire, raising his palm so that the cook could see the bits of dirt and scraps sticking to his chef’s palm. "That’s what the inside of your head looks like now."
Anthony Bourdain, Kitchen Confidential
When GitHub set out to create the Actions platform, they wanted to build something that was great for CI/CD workflows – building a project, running tests and deploying it – but that could also help you automate common tasks in your project. In this case, keeping your repository nice and clean.
At the bottom of the starter workflows is a workflow that closes stale issues and pull requests.
It will run on a schedule trigger, so at midnight UTC every day:
on: schedule: - cron: "0 0 * * *"
When it runs, it will run the stale action which will look at the issues and pull requests in your repository and find the ones that haven't had any action for a few months. It will then post a message in the issue and add a label indicating that the issue is stale. If that issue stays stale for another week, it's closed.
This makes sure that every stale issue is identified, but it also gives people enough time to tell the stale action to keep an issue or pull request open – a lot of these old issues and PRs to have value after all!
Ultimately, the stale workflow is an easy way to reduce some of the distractions in your repository, and allow you to "work clean".