name: "Close stale issues"
on:
  schedule:
  - cron: "0 0 * * *"

permissions:
  contents: read

jobs:
  stale:
    permissions:
      issues: write  # for actions/stale to close stale issues
      pull-requests: write  # for actions/stale to close stale PRs
    runs-on: ubuntu-latest
    steps:
    - name: Harden Runner
      uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
      with:
        egress-policy: audit

    - uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # v10.1.1
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        stale-issue-message: 'This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.'
        stale-issue-label: 'stale'
        exempt-issue-labels: 'never-stale'
        days-before-stale: 90
        days-before-close: 30

