|
7 | 7 | files: |
8 | 8 | required: true |
9 | 9 | type: string |
| 10 | + event_name: |
| 11 | + required: true |
| 12 | + type: string |
10 | 13 | check_name: |
11 | 14 | required: true |
12 | 15 | type: string |
13 | 16 | comment_title: |
14 | 17 | required: true |
15 | 18 | type: string |
| 19 | + run_id: |
| 20 | + required: true |
| 21 | + type: number |
| 22 | + |
| 23 | +permissions: |
| 24 | + checks: write |
| 25 | + pull-requests: write |
| 26 | + |
| 27 | + # required by download step to access artifacts API |
| 28 | + actions: read |
16 | 29 |
|
17 | 30 | jobs: |
18 | 31 | test-results: |
19 | 32 | runs-on: ubuntu-latest |
20 | 33 | steps: |
21 | | - - name: Download Artifacts |
22 | | - uses: actions/github-script@v3 |
| 34 | + - name: Download and Extract Artifacts |
| 35 | + uses: dawidd6/action-download-artifact@v3 |
23 | 36 | with: |
24 | | - script: | |
25 | | - var fs = require('fs'); |
26 | | - var path = require('path'); |
27 | | - var artifacts_path = path.join('${{github.workspace}}', 'artifacts') |
28 | | - fs.mkdirSync(artifacts_path, { recursive: true }) |
29 | | -
|
30 | | - var artifacts = await github.actions.listWorkflowRunArtifacts({ |
31 | | - owner: context.repo.owner, |
32 | | - repo: context.repo.repo, |
33 | | - run_id: ${{ github.event.workflow_run.id }}, |
34 | | - }); |
| 37 | + run_id: ${{ inputs.run_id }} |
| 38 | + path: artifacts |
35 | 39 |
|
36 | | - for (const artifact of artifacts.data.artifacts) { |
37 | | - var download = await github.actions.downloadArtifact({ |
38 | | - owner: context.repo.owner, |
39 | | - repo: context.repo.repo, |
40 | | - artifact_id: artifact.id, |
41 | | - archive_format: 'zip', |
42 | | - }); |
43 | | - var artifact_path = path.join(artifacts_path, `${artifact.name}.zip`) |
44 | | - fs.writeFileSync(artifact_path, Buffer.from(download.data)); |
45 | | - console.log(`Downloaded ${artifact_path}`); |
46 | | - } |
47 | | - - name: Extract Artifacts |
48 | | - run: | |
49 | | - for file in artifacts/*.zip |
50 | | - do |
51 | | - if [ -f "$file" ] |
52 | | - then |
53 | | - dir="${file/%.zip/}" |
54 | | - mkdir -p "$dir" |
55 | | - unzip -d "$dir" "$file" |
56 | | - fi |
57 | | - done |
58 | 40 | - name: Publish UT Results |
59 | 41 | uses: EnricoMi/publish-unit-test-result-action@v2 |
60 | 42 | with: |
61 | 43 | commit: ${{ inputs.commit }} |
62 | 44 | files: ${{ inputs.files }} |
63 | 45 | check_name: ${{ inputs.check_name }} |
64 | 46 | comment_title: ${{ inputs.comment_title }} |
| 47 | + event_name: ${{ inputs.event_name }} |
| 48 | + # u should upload the event file with upload name 'event-file' |
| 49 | + event_file: artifacts/event-file/event.json |
0 commit comments