name: Close stale issues

on:
  schedule:
    - cron: '0 0 * * *' # runs daily at midnight UTC
  workflow_dispatch: # allows manual triggering

permissions:
  issues: write
  pull-requests: write

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9
        with:
          stale-issue-message: 'This issue has been automatically marked as stale due to inactivity. It will be closed in 24 hours if no further activity occurs.'
          stale-issue-label: 'stale'
          days-before-stale: 4
          days-before-close: 1
          exempt-issue-labels: 'keep-alive'