name: Mark stale issues and lock closed threads
on:
  schedule:
    - cron: '0 */12 * * *'  # twice, daily
jobs:
  lock:
    timeout-minutes: 10
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v3
        with:
          stale-issue-message: >
            :warning: **This issue has been automatically marked stale because
            due to 60 days of inactivity.** If this issue is still valid, please
            reply to it or it will be closed in 7 days.
          stale-pr-message: >-
            :warning: **This pull request has been automatically marked stale
            due to 60 days of inactivity.** If this PR is still valid, please
            reply to it or it will be closed in 7 days.
          exempt-issue-labels: ':heart:,needs-triage,help wanted,1. announcement,2. status:confirmed,2. status:waiting,2. status:undecided'
          exempt-pr-labels:    ':heart:,needs-triage,2. status:confirmed,2. status:archived,2. status:resolved-temporarily,2. status:waiting,2. status:needs-work,2. status:undecided'
          stale-issue-label: stale
          stale-pr-label: stale
          exempt-all-milestones: true
          exempt-all-assignees: true
      - uses: dessant/lock-threads@v2
        with:
          github-token: ${{ github.token }}
          issue-lock-inactive-days: '90'
          pr-lock-inactive-days: '90'
