File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change 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 :
18254047 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
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+ });
You can’t perform that action at this time.
0 commit comments