Skip to content

Commit 564c02b

Browse files
committed
ci: ✨ make E2E tests optional with local attestation requirement
Add PR template with E2E attestation checkbox, a lightweight attestation workflow that verifies the checkbox is checked, and gate the E2E job behind a `run-e2e` label for on-demand CI runs.
1 parent 942eb32 commit 564c02b

3 files changed

Lines changed: 53 additions & 1 deletion

File tree

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Description
2+
<!-- Describe your changes -->
3+
4+
## Testing
5+
6+
- [ ] Unit tests pass (`npm test`)
7+
- [ ] E2E tests pass locally (`npm run test:e2e`)

.github/workflows/build-pipeline.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,11 @@ jobs:
133133
e2e-tests:
134134
name: E2E Tests
135135
needs: [lint, type-check, test, security-audit]
136+
if: >-
137+
(github.event_name == 'pull_request' &&
138+
contains(github.event.pull_request.labels.*.name, 'run-e2e')) ||
139+
github.event_name == 'workflow_dispatch'
136140
runs-on: ubuntu-latest
137-
environment: e2e-approval
138141
steps:
139142
- name: Checkout Code
140143
uses: actions/checkout@v4
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: E2E Attestation
3+
4+
on:
5+
pull_request:
6+
types: [opened, synchronize, reopened, edited]
7+
branches:
8+
- main
9+
- develop
10+
11+
permissions:
12+
contents: read
13+
pull-requests: read
14+
15+
jobs:
16+
e2e-attestation:
17+
name: E2E Attestation
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check E2E Attestation
21+
uses: actions/github-script@v7
22+
with:
23+
script: |
24+
const body = context.payload.pull_request.body || '';
25+
const pattern = /- \[x\]\s+E2E tests pass locally/i;
26+
27+
if (!pattern.test(body)) {
28+
core.setFailed(
29+
'E2E attestation required: Please check the box in the PR description ' +
30+
'confirming you have run E2E tests locally and they pass.\n\n' +
31+
'Add this to your PR description:\n' +
32+
'- [x] E2E tests pass locally (`npm run test:e2e`)'
33+
);
34+
return;
35+
}
36+
37+
core.info('E2E attestation confirmed.');
38+
39+
await core.summary
40+
.addHeading('E2E Attestation', 3)
41+
.addRaw('Developer has attested that E2E tests were run locally and pass.')
42+
.write();

0 commit comments

Comments
 (0)