-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(tests): Avoid the use of pull_request_target where possible
- Loading branch information
1 parent
cbf1e94
commit 5515824
Showing
7 changed files
with
404 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Publish test results | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Wokwi tests"] | ||
types: | ||
- completed | ||
|
||
# No permissions by default | ||
permissions: { contents: read } | ||
|
||
jobs: | ||
unit-test-results: | ||
name: Unit Test Results | ||
if: | | ||
github.event.workflow_run.conclusion == 'success' || | ||
github.event.workflow_run.conclusion == 'failure' || | ||
github.event.workflow_run.conclusion == 'timed_out' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
statuses: write | ||
checks: write | ||
pull-requests: write | ||
steps: | ||
- name: Download and Extract Artifacts | ||
uses: dawidd6/action-download-artifact@v6 | ||
with: | ||
run_id: ${{ github.event.workflow_run.id }} | ||
path: ./artifacts | ||
|
||
- name: Get original info | ||
run: | | ||
original_event=$(cat ./artifacts/parent-artifacts/event.txt) | ||
original_sha=$(cat ./artifacts/parent-artifacts/sha.txt) | ||
echo "original_event=$original_event" >> $GITHUB_ENV | ||
echo "original_sha=$original_sha" >> $GITHUB_ENV | ||
echo "original_event = $original_event" | ||
echo "original_sha = $original_sha" | ||
- name: Publish Unit Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
with: | ||
commit: ${{ env.original_sha }} | ||
event_file: ./artifacts/parent-artifacts/event_file/event.json | ||
event_name: ${{ env.original_event }} | ||
files: ./artifacts/**/*.xml | ||
action_fail: true | ||
|
||
- name: Report conclusion | ||
uses: actions/github-script@v7 | ||
if: always() | ||
with: | ||
script: | | ||
const owner = '${{ github.repository_owner }}'; | ||
const repo = '${{ github.repository }}'.split('/')[1]; | ||
const sha = '${{ env.original_sha }}'; | ||
core.debug(`owner: ${owner}`); | ||
core.debug(`repo: ${repo}`); | ||
core.debug(`sha: ${sha}`); | ||
const { context: name, state } = (await github.rest.repos.createCommitStatus({ | ||
context: 'Runtime Tests / Report results (${{ env.original_event }} -> workflow_run -> workflow_run)', | ||
owner: owner, | ||
repo: repo, | ||
sha: sha, | ||
state: '${{ job.status }}', | ||
description: '${{ job.status }}' ? 'Runtime tests successful' : 'Runtime tests failed', | ||
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' | ||
})).data; | ||
core.info(`${name} is ${state}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.