Skip to content

Commit 2194498

Browse files
authored
Merge 1df3d9b into f3cfd75
2 parents f3cfd75 + 1df3d9b commit 2194498

4 files changed

Lines changed: 44 additions & 1 deletion

File tree

.github/workflows/auto-response.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ permissions: {}
1919

2020
jobs:
2121
auto-response:
22+
if: >-
23+
${{
24+
!(
25+
(github.event.action == 'labeled' || github.event.action == 'unlabeled') &&
26+
github.event.label.name == 'dependency-guard-backfill'
27+
)
28+
}}
2229
permissions:
2330
contents: read
2431
issues: write

.github/workflows/clawsweeper-dispatch.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,17 @@ concurrency:
2424
jobs:
2525
dispatch:
2626
runs-on: ubuntu-latest
27-
if: ${{ github.event_name == 'issue_comment' || !(endsWith(github.actor, '[bot]') && (github.event.action == 'labeled' || github.event.action == 'unlabeled')) }}
27+
if: >-
28+
${{
29+
github.event_name == 'issue_comment' ||
30+
(
31+
!(
32+
(github.event.action == 'labeled' || github.event.action == 'unlabeled') &&
33+
github.event.label.name == 'dependency-guard-backfill'
34+
) &&
35+
!(endsWith(github.actor, '[bot]') && (github.event.action == 'labeled' || github.event.action == 'unlabeled'))
36+
)
37+
}}
2838
env:
2939
HAS_CLAWSWEEPER_APP_PRIVATE_KEY: ${{ secrets.CLAWSWEEPER_APP_PRIVATE_KEY != '' }}
3040
CLAWSWEEPER_APP_CLIENT_ID: Iv23liOECG0slfuhz093

.github/workflows/real-behavior-proof.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ permissions: {}
1616
jobs:
1717
real-behavior-proof:
1818
name: Real behavior proof
19+
if: >-
20+
${{
21+
!(
22+
(github.event.action == 'labeled' || github.event.action == 'unlabeled') &&
23+
github.event.label.name == 'dependency-guard-backfill'
24+
)
25+
}}
1926
permissions:
2027
contents: read
2128
issues: read

test/scripts/dependency-guard-workflow.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { parse } from "yaml";
44

55
const WORKFLOW = ".github/workflows/dependency-guard.yml";
66
const CODEOWNERS = ".github/CODEOWNERS";
7+
const BACKFILL_EXCLUDED_WORKFLOWS = [
8+
[".github/workflows/auto-response.yml", "auto-response"],
9+
[".github/workflows/clawsweeper-dispatch.yml", "dispatch"],
10+
[".github/workflows/real-behavior-proof.yml", "real-behavior-proof"],
11+
];
712

813
type WorkflowStep = {
914
name?: string;
@@ -33,6 +38,10 @@ function readWorkflow(): Workflow {
3338
return parse(readFileSync(WORKFLOW, "utf8")) as Workflow;
3439
}
3540

41+
function readWorkflowFile(path: string): Workflow {
42+
return parse(readFileSync(path, "utf8")) as Workflow;
43+
}
44+
3645
describe("dependency guard workflow", () => {
3746
it("uses the dependency guard check name", () => {
3847
const parsed = readWorkflow();
@@ -57,6 +66,16 @@ describe("dependency guard workflow", () => {
5766
expect(job?.if).toContain("github.event.label.name == 'dependency-guard-backfill'");
5867
});
5968

69+
it("keeps the temporary backfill label from waking unrelated PR automation", () => {
70+
for (const [workflowFile, jobName] of BACKFILL_EXCLUDED_WORKFLOWS) {
71+
const job = readWorkflowFile(workflowFile).jobs?.[jobName];
72+
73+
expect(job?.if).toContain("github.event.action == 'labeled'");
74+
expect(job?.if).toContain("github.event.action == 'unlabeled'");
75+
expect(job?.if).toContain("github.event.label.name == 'dependency-guard-backfill'");
76+
}
77+
});
78+
6079
it("uses a metadata-only pull_request_target workflow with minimal write permissions", () => {
6180
const workflow = readFileSync(WORKFLOW, "utf8");
6281
const parsed = readWorkflow();

0 commit comments

Comments
 (0)