name: "Close Stale Issues"

# Controls when the action will run.
on:
  workflow_dispatch:
  schedule:
    - cron: "0 */4 * * *"

jobs:
  cleanup:
    permissions:
      issues: write
      contents: read
      pull-requests: write
    runs-on: ubuntu-latest
    name: Stale issue job
    steps:
      - uses: aws-actions/stale-issue-cleanup@v5
        with:
          issue-types: issues
          # Setting messages to an empty string will cause the automation to skip
          # that category
          ancient-issue-message: This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
          stale-issue-message: This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

          # These labels are required
          stale-issue-label: closing-soon
          exempt-issue-labels: no-autoclose, p1
          response-requested-label: response-requested

          # Don't set closed-for-staleness label to skip closing very old issues
          # regardless of label
          closed-for-staleness-label: closed-for-staleness

          # Issue timing
          days-before-stale: 7
          days-before-close: 2
          days-before-ancient: 365

          # If you don't want to mark a issue as being ancient based on a
          # threshold of "upvotes", you can set this here. An "upvote" is
          # the total number of +1, heart, hooray, and rocket reactions
          # on an issue.
          minimum-upvotes-to-exempt: 5

          repo-token: ${{ secrets.GITHUB_TOKEN }}
          loglevel: DEBUG
          # Set dry-run to true to not perform label or close actions.
          dry-run: false
