name: 'Manage stale issues and pull requests'

permissions:
  issues: write
  pull-requests: write

on:
  schedule:
    # Sundays and Wednesdays at 8:17 p.m. UTC
    - cron: '17 20 * * 0,3'
  workflow_dispatch:

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
        with:
          # process older PRs first
          ascending: true
          operations-per-run: 100
          stale-issue-label: 'stale'
          stale-pr-label: 'stale'
          exempt-issue-labels: 'bug,keep-open'
          exempt-pr-labels: 'keep-open'
          close-issue-message: 'Closed due to inactivity. Re-open and remove "stale" label if it should remain open for an additional period of time'
          close-pr-message: 'Closed due to inactivity. Re-open and remove "stale" label if it should remain open for an additional period of time'
