name: 'Close stale issues'
on:
  schedule:
    - cron: '0 0 * * *'
jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v3
        with:
          close-issue-message: ${{ env.CLOSE_MESSAGE }}
          close-pr-message: ${{ env.CLOSE_MESSAGE }}
          days-before-stale: 30
          days-before-close: 5
          exempt-issue-labels: ${{ env.EXEMPT_LABEL }}
          exempt-pr-labels: ${{ env.EXEMPT_LABEL }}
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          stale-issue-label: ${{ env.STALE_LABEL }}
          stale-pr-label: ${{ env.STALE_LABEL }}
          stale-issue-message: ${{ env.STALE_MESSAGE }}
          stale-pr-message: ${{ env.STALE_MESSAGE }}
        env:
          CLOSE_MESSAGE: 'This issue has been closed because it is stale. Reopen if necessary.'
          EXEMPT_LABEL: 'status: needs discussion'
          STALE_LABEL: 'status: stale'
          STALE_MESSAGE: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
