⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat: allow manual AI comment scans for existing PRs
Tin70de375184e7
diff --git a/.github/workflows/slop-labeler.yml b/.github/workflows/slop-labeler.ymlindex a84f8bbbf..5e2ba1df9 100644--- a/.github/workflows/slop-labeler.yml+++ b/.github/workflows/slop-labeler.yml@@ -1,6 +1,13 @@name: AI comment labeler+run-name: "AI comment scan for PR #${{ github.event.pull_request.number || inputs.pull_request_number }}"on:+ workflow_dispatch:+ inputs:+ pull_request_number:+ description: Open pull request number+ required: true+ type: string# zizmor: ignore[dangerous-triggers] Executes only trusted workflow code;# PR blobs are fetched as text through the API and parsed, never executed.pull_request_target:@@ -12,7 +19,7 @@ permissions:issues: writeconcurrency:- group: slop-labeler-${{ github.event.pull_request.number }}+ group: slop-labeler-${{ github.event.pull_request.number || inputs.pull_request_number }}cancel-in-progress: truejobs:diff --git a/scripts/slop-labeler/README.md b/scripts/slop-labeler/README.mdindex 60fcc0432..29e537034 100644--- a/scripts/slop-labeler/README.md+++ b/scripts/slop-labeler/README.md@@ -14,6 +14,8 @@ doesn't mean 99% accuracy.PR code is fetched as text and parsed, never executed. The workflow startsrunning once merged into the default branch.+To scan an existing PR, run the workflow manually with its PR number.+Run the tests:```shdiff --git a/scripts/slop-labeler/check.mjs b/scripts/slop-labeler/check.mjsindex 70443eb17..6986407c1 100644--- a/scripts/slop-labeler/check.mjs+++ b/scripts/slop-labeler/check.mjs@@ -11,7 +11,8 @@ export async function checkPullRequest(fetcher = fetch,scan = scanFiles,) {- const number = event.pull_request?.number;+ const number =+ event.pull_request?.number ?? Number(event.inputs?.pull_request_number);if (!Number.isSafeInteger(number) || number <= 0) {throw new Error("Invalid pull request number.");}diff --git a/scripts/slop-labeler/check.test.mjs b/scripts/slop-labeler/check.test.mjsindex bae025fcc..af18c3003 100644--- a/scripts/slop-labeler/check.test.mjs+++ b/scripts/slop-labeler/check.test.mjs@@ -12,6 +12,42 @@ import {event,} from "./test-fixtures.mjs";+test("manual runs validate the PR number and use the same author exclusion", async () => {+ const dispatch = { inputs: { pull_request_number: "42" } };+ const contributor = fixture();+ assert.equal(+ await checkPullRequest(dispatch, env, contributor.fetcher, flagged),+ "flagged",+ );+ const maintainer = fixture({ authorAccess: { permission: "write" } });+ assert.equal(+ await checkPullRequest(dispatch, env, maintainer.fetcher, flagged),+ "maintainer",+ );+ assert.equal(writes(maintainer.state).length, 0);+ for (const number of [+ undefined,+ "",+ "0",+ "-1",+ "42.5",+ "invalid",+ "9007199254740992",+ ]) {+ const { state, fetcher } = fixture();+ await assert.rejects(+ checkPullRequest(+ { inputs: { pull_request_number: number } },+ env,+ fetcher,+ flagged,+ ),+ /Invalid pull request number/,+ );+ assert.equal(state.calls.length, 0);+ }+});+test("adds the label and one advisory comment; reruns neither duplicate nor rewrite it", async () => {const { state, fetcher } = fixture({ labelExists: false });assert.equal(await checkPullRequest(event, env, fetcher, flagged), "flagged");