]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Enforce issue templates on GitHub
authorFlole <Flole998@users.noreply.github.com>
Sat, 10 Aug 2024 16:19:02 +0000 (16:19 +0000)
committerFlole <Flole998@users.noreply.github.com>
Sat, 10 Aug 2024 16:19:02 +0000 (16:19 +0000)
.github/workflows/close-issue-on-label.yml [new file with mode: 0644]
.github/workflows/enforce-issue-template.yml [new file with mode: 0644]

diff --git a/.github/workflows/close-issue-on-label.yml b/.github/workflows/close-issue-on-label.yml
new file mode 100644 (file)
index 0000000..d1b0f72
--- /dev/null
@@ -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 (file)
index 0000000..0ab2cc4
--- /dev/null
@@ -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