name: "Issue: Wontfix"

on:
  issues:
    types: [labeled]

jobs:
  wontfix:
    if: github.event.label.name == 'wontfix'
    runs-on: ubuntu-latest
    steps:
      - name: Comment and close issue
        env:
          GH_TOKEN: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
          ISSUE_NUMBER: ${{ github.event.issue.number }}
          REPO: ${{ github.repository }}
          BODY: |
            Hello!

            This is an automated message to let you know that we've triaged this issue and unfortunately, we will be closing it as "not planned".

            We sometimes have to close good ideas (even great ones!) because our limited resources simply do not allow us to pursue all possible features and improvements, and when fixing bugs we have to balance the impact of the bug against the effort required for the fix. Before closing this we considered several factors such as the amount of work involved, the severity of the problem, the number of people affected, whether a workaround is available, and the ongoing cost of maintenance.

            If you're seeing this message and believe you can contribute to this issue, please consider submitting a PR yourself. Astro encourages [community contributions](https://docs.astro.build/en/contribute/)!

            If you have more questions, come and say hi in the [Astro Discord](https://astro.build/chat).
        run: |
          gh issue comment "$ISSUE_NUMBER" --repo "$REPO" --body "$BODY"
          gh issue close "$ISSUE_NUMBER" --repo "$REPO" --reason "not planned"
