File tree Expand file tree Collapse file tree 5 files changed +587
-17
lines changed Expand file tree Collapse file tree 5 files changed +587
-17
lines changed Original file line number Diff line number Diff line change 1+ name : Playwright Tests
2+
3+ on :
4+ deployment_status :
5+
6+ permissions :
7+ contents : read
8+ issues : write # ✅ Required for issue comments
9+
10+ jobs :
11+ run-e2es :
12+ if : github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Preview'
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Print environment
16+ run : echo ${{ github.event.deployment_status.environment }}
17+
18+ - name : Checkout repository
19+ uses : actions/checkout@v4
20+
21+ - name : Install dependencies
22+ run : npm ci && npx playwright install --with-deps
23+
24+ - name : Run Playwright tests
25+ env :
26+ BASE_URL : ${{ github.event.deployment_status.environment_url }}
27+ run : npx playwright test
28+
29+ - name : Upload Playwright Report
30+ uses : actions/upload-artifact@v4
31+ if : always()
32+ with :
33+ name : playwright-report
34+ path : playwright-report/
35+ retention-days : 7
36+
37+ - name : GitHub Notification
38+ if : failure()
39+ uses : actions/github-script@v6
40+ with :
41+ github-token : ${{ secrets.GITHUB_TOKEN }} # ✅ Fix GitHub API auth
42+ script : |
43+ github.rest.issues.createComment({
44+ owner: context.repo.owner,
45+ repo: context.repo.repo,
46+ issue_number: 1,
47+ body: "🚨 Playwright tests failed after deployment!"
48+ });
You can’t perform that action at this time.
0 commit comments