Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit e3b13eb

Browse files
authored
Update commit status earlier in cypress workflow_run (#9263)
1 parent d87f4b0 commit e3b13eb

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

.github/workflows/cypress.yaml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
permissions:
1414
actions: read
1515
issues: read
16+
statuses: write
1617
pull-requests: read
1718
outputs:
1819
uuid: ${{ steps.uuid.outputs.value }}
@@ -22,6 +23,16 @@ jobs:
2223
commit_email: ${{ steps.commit.outputs.email }}
2324
percy_enable: ${{ steps.percy.outputs.value || '1' }}
2425
steps:
26+
# We create the status here and then update it to success/failure in the `report` stage
27+
# This provides an easy link to this workflow_run from the PR before Cypress is done.
28+
- uses: Sibz/github-status-action@v1
29+
with:
30+
authToken: ${{ secrets.GITHUB_TOKEN }}
31+
state: pending
32+
context: ${{ github.workflow }} / cypress (${{ github.event.workflow_run.event }} => ${{ github.event_name }})
33+
sha: ${{ github.event.workflow_run.head_sha }}
34+
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
35+
2536
- id: prdetails
2637
if: github.event.workflow_run.event == 'pull_request'
2738
uses: matrix-org/pr-details-action@v1.2
@@ -62,7 +73,6 @@ jobs:
6273
runs-on: ubuntu-latest
6374
permissions:
6475
actions: read
65-
statuses: write
6676
issues: read
6777
pull-requests: read
6878
environment: Cypress
@@ -156,21 +166,21 @@ jobs:
156166
if-no-files-found: ignore
157167
retention-days: 1
158168

159-
160-
# This job cannot have a pretty name due to https://github.com/haya14busa/action-workflow_run-status/issues/158
161-
cypress:
169+
report:
170+
name: Report results
162171
needs: tests
163172
runs-on: ubuntu-latest
164173
if: always()
165174
permissions:
166175
statuses: write
167176
steps:
168-
# Wire up the status check for this workflow_run action
169-
- uses: haya14busa/action-workflow_run-status@967ed83efa565c257675ed70cfe5231f062ddd94 # v1.0.0
170-
171-
- name: Check status
172-
if: ${{ needs.tests.result != 'success' }}
173-
run: exit 1
177+
- uses: Sibz/github-status-action@v1
178+
with:
179+
authToken: ${{ secrets.GITHUB_TOKEN }}
180+
state: ${{ needs.tests.result }} == 'success' && 'success' || 'failure'
181+
context: ${{ github.workflow }} / cypress (${{ github.event.workflow_run.event }} => ${{ github.event_name }})
182+
sha: ${{ github.event.workflow_run.head_sha }}
183+
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
174184

175185
store-benchmark:
176186
needs: tests

0 commit comments

Comments
 (0)