From: Flole Date: Sat, 10 Aug 2024 16:19:02 +0000 (+0000) Subject: Enforce issue templates on GitHub X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=49ac9387186d32b55a399a04155e835eac22c6c1;p=thirdparty%2Ftvheadend.git Enforce issue templates on GitHub --- diff --git a/.github/workflows/close-issue-on-label.yml b/.github/workflows/close-issue-on-label.yml new file mode 100644 index 000000000..d1b0f722e --- /dev/null +++ b/.github/workflows/close-issue-on-label.yml @@ -0,0 +1,28 @@ +name: Close issue based on label +on: + issues: + types: + - labeled +jobs: + close-unsuported-version: + if: github.event.label.name == 'unsupported-version' + name: Autoclose issues with unsupported versions + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Autoclose issues with unsupported versions + uses: peter-evans/close-issue@v3 + with: + comment: "@${{ github.event.issue.user.login }} this issue was automatically closed because you are using an unsupported version" + close-template-ignored: + if: github.event.label.name == 'template-ignored' + name: Autoclose issues ignoring the template + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Autoclose issues ignoring the template + uses: peter-evans/close-issue@v3 + with: + comment: "@${{ github.event.issue.user.login }} this issue was automatically closed because you did not follow the issue template." \ No newline at end of file diff --git a/.github/workflows/enforce-issue-template.yml b/.github/workflows/enforce-issue-template.yml new file mode 100644 index 000000000..0ab2cc477 --- /dev/null +++ b/.github/workflows/enforce-issue-template.yml @@ -0,0 +1,35 @@ +name: Enforce issue template +on: + issues: + types: [opened, edited, renamed] + +jobs: + auto_close_issues: + runs-on: ubuntu-latest + steps: + - name: Autoclose issues that did not follow issue template + if: startsWith(github.event.issue.title, '[BUG]:') + uses: roots/issue-closer@v1.2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-close-message: "@${issue.user.login} this issue was automatically closed because it did not follow the issue template" + issue-pattern: ".*### Description.*" + - name: Autoclose issues that are using an old version + if: startsWith(github.event.issue.title, '[BUG]:') + uses: roots/issue-closer@v1.2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-close-message: "@${issue.user.login} this issue was automatically closed because you are using an unsupported version" + issue-pattern: ".*### Tvheadend Version[\\r\\n]+v4\\.(3 \\(development\\)|4 \\(stable\\)).*" + - name: Autoclose feature ideas which are not developed by the user + if: startsWith(github.event.issue.title, '[FEATURE]:') + uses: roots/issue-closer@v1.2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-close-message: "@${issue.user.login} this issue was automatically closed because you are not willing to develop this" + issue-pattern: ".*### Acceptance[\\r\\n]+- \\[X\\] The proposal will be developed and maintained by me.*" + - name: Autoclose issues not having an accepted prefix + if: "!startsWith(github.event.issue.title, '[BUG]:') && !startsWith(github.event.issue.title, '[FEATURE]:')" + uses: peter-evans/close-issue@v3 + with: + comment: "@${{ github.event.issue.user.login }} this issue was automatically closed because it did not follow the issue template" \ No newline at end of file