name: Scheduled tasks 🕑

on:
  schedule:
    - cron: '30 1 * * *'
  workflow_dispatch:
permissions:
  issues: write
  pull-requests: write

jobs:
  issues:
    name: Check stale issues and PRs
    runs-on: ubuntu-latest
    if: ${{ contains(github.repository, 'jellyfin/') }}
    steps:
      - uses: actions/stale@1e223db275d687790206a7acac4d1a11bd6fe629 # v10.4.0
        with:
          repo-token: ${{ secrets.JF_BOT_TOKEN }}
          operations-per-run: 75
          # Issues receive a stale warning after 120 days and close after an additional 21 days
          days-before-stale: 120
          days-before-close: 21
          exempt-issue-labels: regression,security,roadmap,future,feature,enhancement,confirmed
          stale-issue-label: stale
          stale-issue-message: |-
            This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

            If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

            This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on [Matrix or Social Media](https://jellyfin.org/contact).
          # PRs are closed after having unresolved merge conflicts for 90 days
          days-before-pr-stale: 0
          days-before-pr-close: 90
          only-pr-labels: merge conflict
          stale-pr-label: stale
          close-pr-message: |-
            This PR has been closed due to having unresolved merge conflicts.
