Skip to content

Commit 98289b8

Browse files
committed
test message
1 parent b623582 commit 98289b8

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

.github/workflows/cypress.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ jobs:
1010
cypress:
1111
runs-on: ubuntu-latest
1212

13+
# Add permissions needed for PR comments
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
1318
strategy:
1419
matrix:
1520
node-version: [22.x] # Latest LTS version
21+
# Don't cancel other matrix jobs if one fails
22+
fail-fast: false
1623

1724
steps:
1825
- uses: actions/[email protected]
@@ -40,6 +47,7 @@ jobs:
4047
run: yarn cypress install
4148

4249
- name: Run Cypress tests
50+
id: cypress
4351
uses: cypress-io/[email protected]
4452
with:
4553
start: yarn start
@@ -62,4 +70,29 @@ jobs:
6270
with:
6371
name: cypress-videos
6472
path: cypress/videos
65-
if-no-files-found: ignore
73+
if-no-files-found: ignore
74+
75+
# Add test summary to PR
76+
- name: Add PR Comment
77+
if: github.event_name == 'pull_request' && (success() || failure())
78+
uses: actions/github-script@v7
79+
with:
80+
script: |
81+
const testStatus = '${{ steps.cypress.outcome }}' === 'success' ? '✅' : '❌';
82+
const artifactsUrl = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
83+
84+
const comment = `## Cypress Test Results ${testStatus}
85+
86+
**Status:** ${testStatus === '✅' ? 'All tests passed!' : 'Some tests failed'}
87+
88+
${testStatus === '❌' ? `### Test Artifacts
89+
- [View Screenshots and Videos](${artifactsUrl})` : ''}
90+
91+
[View Full Test Run](${artifactsUrl})`;
92+
93+
github.rest.issues.createComment({
94+
issue_number: context.issue.number,
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
body: comment
98+
});

0 commit comments

Comments
 (0)