# Source: https://github.com/actions/stale

name: "Close stale issues and PRs"
on:
  workflow_dispatch:
  schedule:
    - cron: "30 1 * * *"
permissions:
  issues: write
jobs:
  stale:
    runs-on: ubuntu-latest
    if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'quarto-dev/quarto-cli')
    steps:
      - uses: actions/stale@v10
        with:
          start-date: 2023-01-01T01:00:00Z
          stale-issue-label: "stale"
          any-of-issue-labels: "needs-repro"
          close-issue-reason: "not_planned"
          ignore-issue-updates: false
          remove-issue-stale-when-updated: false
          stale-issue-message: |
            Thank you for using Quarto and reporting an issue!

            Unfortunately, this issue is now considered stale because it has been opened since 14 days without providing a "working" reproducible example to help us investigate.
            If you are still facing the issue, please review the ["Bug Reports" guide](https://quarto.org/bug-reports.html) on how to provide a fully reproducible example as a self-contained Quarto document or a link to a Git repository.
            Without a reproducible example, it is unlikely that the issue will be addressed.

            You can share a Quarto document using the following syntax, _i.e._, using more backticks than you have in your document (usually four ` ```` `).

            `````
            ````qmd
            ---
            title: "Reproducible Quarto Document"
            format: html
            ---

            This is a reproducible Quarto document using `format: html`.
            It is written in Markdown and contains embedded R code.
            When you run the code, it will produce a plot.

            ```{r}
            plot(cars)
            ```

            The end.
            ````
            `````
          close-issue-message: |
            This issue has been automatically closed because it has been opened for some time without providing a "working" reproducible example that would help us investigate.
          days-before-stale: 14
          days-before-close: -1
