Skip to content

Commit 7ee7438

Browse files
committed
Publish test results from workflow_run only
1 parent 1ecf91a commit 7ee7438

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,12 @@ jobs:
108108
name: codecov-umbrella
109109
fail_ci_if_error: false
110110

111-
publish-test-results:
112-
needs: test
111+
event_file:
112+
name: "Event File"
113113
runs-on: ubuntu-latest
114-
# the build-and-test job might be skipped, we don't need to run this job then
115-
if: success() || failure()
116-
117114
steps:
118-
- name: Download Artifacts
119-
uses: actions/download-artifact@v2
120-
with:
121-
path: test-results
122-
123-
- name: Publish Unit Test Results
124-
uses: EnricoMi/publish-unit-test-result-action@v1
115+
- name: Upload
116+
uses: actions/upload-artifact@v2
125117
with:
126-
files: test-results/**/*.xml
118+
name: Event File
119+
path: ${{ github.event_path }}
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copied from https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.18/README.md#support-fork-repositories-and-dependabot-branches
1+
# Copied from https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.23/README.md#support-fork-repositories-and-dependabot-branches
22

33
name: Publish test results
44

@@ -12,11 +12,7 @@ jobs:
1212
publish-test-results:
1313
name: Publish test results
1414
runs-on: ubuntu-latest
15-
if: >
16-
github.event.workflow_run.conclusion != 'skipped' && (
17-
github.event.sender.login == 'dependabot[bot]' ||
18-
github.event.workflow_run.head_repository.full_name != github.repository
19-
)
15+
if: github.event.workflow_run.conclusion != 'skipped'
2016

2117
steps:
2218
- name: Download and extract artifacts
@@ -26,13 +22,10 @@ jobs:
2622
mkdir artifacts && cd artifacts
2723
2824
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
29-
artifacts=$(gh api $artifacts_url -q '.artifacts[] | {name: .name, url: .archive_download_url}')
3025
31-
IFS=$'\n'
32-
for artifact in $artifacts
26+
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
3327
do
34-
name=$(jq -r .name <<<$artifact)
35-
url=$(jq -r .url <<<$artifact)
28+
IFS=$'\t' read name url <<< "$artifact"
3629
gh api $url > "$name.zip"
3730
unzip -d "$name" "$name.zip"
3831
done
@@ -41,4 +34,6 @@ jobs:
4134
uses: EnricoMi/publish-unit-test-result-action@v1
4235
with:
4336
commit: ${{ github.event.workflow_run.head_sha }}
37+
event_file: artifacts/Event File/event.json
38+
event_name: ${{ github.event.workflow_run.event }}
4439
files: "artifacts/**/*.xml"

0 commit comments

Comments
 (0)