Skip to content

Commit 03745bb

Browse files
authored
Fail fast if e2e tests if PR is from fork. (#2706)
* Fail fast if e2e tests if PR is from fork. * this * this * this * this * boop * this
1 parent baaaba9 commit 03745bb

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/health_checks.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ jobs:
324324
cdk-lib-version: ${{ needs.resolve_inputs.outputs.cdk_lib_version }}
325325
- name: Check if any E2E tests should run
326326
id: check
327-
run: echo "run_e2e=$(npx tsx scripts/do_include_e2e.ts)" >> "$GITHUB_OUTPUT"
327+
run: |
328+
run_e2e=$(npx tsx scripts/do_include_e2e.ts)
329+
echo "run_e2e=$run_e2e" >> "$GITHUB_OUTPUT"
328330
- run: echo run_e2e set to ${{ steps.check.outputs.run_e2e }}
329331
- name: Check if Package Manager E2E tests should be included
330332
id: check_package_manager

scripts/do_include_e2e.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ const prHasRunE2ELabel = async () => {
1717
const hasRunE2ELabel = prInfo.labels.some(
1818
(label) => label.name === 'run-e2e',
1919
);
20+
21+
if (
22+
hasRunE2ELabel &&
23+
prInfo.head?.repo?.full_name !== 'aws-amplify/amplify-backend'
24+
) {
25+
throw new Error(
26+
'PR must be opened from a branch in aws-amplify/amplify-backend repository when running e2e tests.',
27+
);
28+
}
29+
2030
return hasRunE2ELabel;
2131
};
2232

0 commit comments

Comments
 (0)