name: 'Manage stale issues and PRs'

on:
  schedule:
    - cron: '37 7 * * *'
  workflow_dispatch:
    inputs:
      action:
        description: "dry-run"
        required: true
        default: "dryrun"
        type: choice
        options:
          - dryrun
          - apply

permissions:
  issues: write
  pull-requests: write

jobs:
  stale:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/stale@v10
        with:
          any-of-labels: 'needs-more-info,answered'
          labels-to-remove-when-unstale: 'needs-more-info,answered'
          days-before-stale: 30
          days-before-close: 7
          stale-issue-label: stale
          remove-stale-when-updated: true
          debug-only: ${{ case(inputs.action == 'dryrun', true, false) }}
