name: 'Close stale issues and PRs'
on:
  workflow_dispatch:
  schedule:
    - cron: '30 00 * * 0,3'

permissions: 
  issues: write
  pull-requests: write

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v9.0.0
        with:
          days-before-stale: 5
          days-before-pr-stale: 8
          days-before-close: 5
          exempt-issue-labels: 'bug, in progress, ongoing'
          exempt-pr-labels: 'bug, in progress, ongoing'
          stale-issue-label: 'stale'
          stale-pr-label: 'stale'        
          stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity in seven days. It will be closed in seven days if no further activity occurs. Thank you for your contributions.'
          stale-pr-message: 'This PR has been automatically marked as stale because it has not had recent activity in ten days. It will be closed in seven days if no further activity occurs. Thank you for your contributions.'
          delete-branch: true
          exempt-draft-pr: true
