Mar 28, 2021

Automatically Close Stale GitHub Issues

Goal

Old issues often remain open. We want to close stale issues automatically.

Stale

Using Stale you can automatically mark and close inactive issues/PRs.

The GitHub Actions bot will mark items as stale like this (this example is configured to stale and close quickly for testing):

Image

Installation steps

From the Actions tab of your repository, create a workflow from a template.

Image

Scroll down to “Automate every step in your process” and select Stale.

Image

Click “Set up this workflow” to open the editor.

Image

By default issues go stale after 60 days and close 7 days later.

You can customize options. For example, to stale after 30 days and close after 5 days, write the following in .github/workflows/stale.yml:

name: Mark stale issues and pull requests

on:
  schedule:
  - cron: "30 1 * * *"

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/stale@v3
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        stale-issue-message: 'Stale issue message'
        stale-pr-message: 'Stale pull request message'
        stale-issue-label: 'no-issue-activity'
        stale-pr-label: 'no-pr-activity'
        days-before-stale: 30
        days-before-close: 5

See the README for additional settings.