name: 'Close stale issues and PRs'
on:
  schedule:
    # The job successfuly goes though all the current issues
    - cron: '0 6 * * *'
  workflow_dispatch:

# Declare default permissions as read only.
permissions: read-all

jobs:
  stale:
    runs-on: ubuntu-latest
    permissions:
      issues: write
      pull-requests: write
    steps:
      - uses: actions/stale@1e223db275d687790206a7acac4d1a11bd6fe629 # v10.4.0
        with:
          days-before-close: 7
          days-before-stale: 14
          # Issue settings
          stale-issue-message: >
            We're marking this issue as unconfirmed because it has not
            had recent activity and we weren't able to confirm or
            reproduce it. The issue will be closed if no further
            activity occurs within the next 7 days. 
            cc @puppeteer/bug-triage
          close-issue-message: >
            We are closing this unconfirmed issue. If the issue still
            persists in the latest version of Puppeteer, please file a
            new issue and include a minimal reproducible example or
            other details that would allow us to reproduce it.
          stale-issue-label: 'unconfirmed'
          exempt-issue-labels: 'confirmed'
          only-issue-types: 'bug'
          # PR settings
          days-before-pr-close: -1
          stale-pr-label: stale
