From 48fbb70ebafd5cf559c72e626b0034228ff53fe7 Mon Sep 17 00:00:00 2001 From: fallenbagel <98979876+Fallenbagel@users.noreply.github.com> Date: Thu, 26 Nov 2026 06:38:18 +0800 Subject: [PATCH] ci: flag issues opened outside the issue forms Issues are increasingly filed by an AI agent on the reporter's behalf through gh or the API, which bypasses the forms, so they arrive without the awaiting triage label, the issue type and the required checkboxes. Label them blocked:template and ask the author to refile through the form, and skip the AI disclosure prompt for them so they don't get two conflicting comments. --- .github/workflows/seerr-labeller.yml | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.github/workflows/seerr-labeller.yml b/.github/workflows/seerr-labeller.yml index 9e1d15d85e..15a36daa5b 100644 --- a/.github/workflows/seerr-labeller.yml +++ b/.github/workflows/seerr-labeller.yml @@ -163,6 +163,8 @@ jobs: console.log('Could not look up author permission:', e.message); } if (['admin', 'write'].includes(permission)) return 'false'; + // issue-template already asks for a new issue through the form + if (!issue.labels.some((l) => l.name === 'awaiting triage')) return 'false'; const body = (issue.body ?? '').replace(/\r\n?/g, '\n'); const match = body.match(/(?:^|\n)### AI Disclosure[ \t]*(?=\n|$)([\s\S]*?)(?=\n### |$)/); @@ -192,3 +194,57 @@ jobs: run: | retry() { n=0; until "$@"; do n=$((n+1)); [ $n -ge 3 ] && break; echo "retry $n: $*" >&2; sleep 2; done; } retry gh issue edit "$NUMBER" -R "$GH_REPO" --add-label ai-disclosure || true + + issue-template: + if: > + github.event_name == 'issues' && + github.event.action == 'opened' && + github.event.issue.user.type != 'Bot' + runs-on: ubuntu-26.04 + concurrency: + group: issue-template-${{ github.event.issue.number }} + permissions: + issues: write + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + NUMBER: ${{ github.event.issue.number }} + ISSUE_AUTHOR: ${{ github.event.issue.user.login }} + steps: + - name: Detect an issue opened outside the issue forms + id: detect + uses: actions/github-script@v9.0.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-encoding: string + script: | + // every form applies it, and GitHub drops labels set by users without push access + const labels = context.payload.issue.labels.map((l) => l.name); + if (labels.includes('awaiting triage')) return 'false'; + + // sender, not author, so issues a maintainer transfers in pass + let permission = 'none'; + try { + const { data } = await github.rest.repos.getCollaboratorPermissionLevel({ + owner: context.repo.owner, + repo: context.repo.repo, + username: context.payload.sender.login, + }); + permission = data.permission; + } catch (e) { + console.log('Could not look up sender permission:', e.message); + } + return String(!['admin', 'write'].includes(permission)); + + - name: Label and comment + if: steps.detect.outputs.result == 'true' + shell: bash + env: + BODY: > + :wave: @${{ env.ISSUE_AUTHOR }}, this issue wasn't opened through one of our issue forms. The forms add the labels and issue type we triage with, along with the required AI Policy and Code of Conduct checkboxes, so issues filed outside them break our [contributing guidelines](https://github.com/seerr-team/seerr/blob/develop/CONTRIBUTING.md#issues). + + Please open a new issue using the form. Issues filed outside the forms may be closed without review. + run: | + retry() { n=0; until "$@"; do n=$((n+1)); [ $n -ge 3 ] && break; echo "retry $n: $*" >&2; sleep 2; done; } + retry gh issue edit "$NUMBER" -R "$GH_REPO" --add-label "blocked:template" || true + retry gh issue comment "$NUMBER" -R "$GH_REPO" -b "$BODY" || true