name: Close stale issues

on:
  schedule:
  - cron: "10 0 * * *"
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  stale:
    if: github.repository_owner == 'python-pillow'
    permissions:
      issues: write

    runs-on: ubuntu-latest

    steps:
    - name: "Check issues"
      uses: actions/stale@v9
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        only-labels: "Awaiting OP Action"
        close-issue-message: "Closing this issue as no feedback has been received."
        days-before-stale: 7
        days-before-issue-close: 0
        days-before-pr-close: -1
        labels-to-remove-when-unstale: "Awaiting OP Action"
