|
35 | 35 | JSON.stringify(${{ github.event.workflow_run }}, null, 2)
|
36 | 36 |
|
37 | 37 | # Download reports
|
38 |
| - - name: 'Download reports' |
39 |
| - uses: actions/github-script@v6 |
40 |
| - with: |
41 |
| - script: | |
42 |
| - async function downloadArtifact(artifactName) { |
43 |
| - console.log(`Looking for artifact: ${artifactName}`); |
44 |
| -
|
45 |
| - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ |
46 |
| - owner: context.repo.owner, |
47 |
| - repo: context.repo.repo, |
48 |
| - run_id: context.payload.workflow_run.id, |
49 |
| - }); |
50 |
| -
|
51 |
| - console.log('Available artifacts:', allArtifacts.data.artifacts.map(a => a.name)); |
52 |
| -
|
53 |
| - let matchArtifact = allArtifacts.data.artifacts.find((artifact) => { |
54 |
| - return artifact.name === artifactName; |
55 |
| - }); |
56 |
| -
|
57 |
| - if (!matchArtifact) { |
58 |
| - throw new Error(`Artifact "${artifactName}" not found!`); |
59 |
| - } |
60 |
| -
|
61 |
| - let download = await github.rest.actions.downloadArtifact({ |
62 |
| - owner: context.repo.owner, |
63 |
| - repo: context.repo.repo, |
64 |
| - artifact_id: matchArtifact.id, |
65 |
| - archive_format: 'zip', |
66 |
| - }); |
67 |
| -
|
68 |
| - let fs = require('fs'); |
69 |
| - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data)); |
70 |
| -
|
71 |
| - return artifactName; |
72 |
| - } |
73 |
| -
|
74 |
| - const sha = context.payload.workflow_run.head_sha; |
75 |
| -
|
76 |
| - // Download both artifacts |
77 |
| - await Promise.all([ |
78 |
| - downloadArtifact('ngx-deploy-npm-coverage-report'), |
79 |
| - downloadArtifact('lint-report') |
80 |
| - ]); |
81 |
| -
|
82 |
| - - name: 'Extract reports' |
83 |
| - run: | |
84 |
| - # Extract coverage report |
85 |
| - mkdir -p coverage/packages/ngx-deploy-npm |
86 |
| - unzip ngx-deploy-npm-coverage-report.zip -d coverage/packages/ngx-deploy-npm |
87 |
| -
|
88 |
| - # Extract lint report |
89 |
| - mkdir -p reports |
90 |
| - unzip lint-report.zip -d reports |
| 38 | + - uses: ./.github/actions/download-coverage-report |
| 39 | + - uses: ./.github/actions/download-lint-report |
91 | 40 |
|
92 | 41 | - name: SonarCloud Scan
|
93 | 42 | uses: SonarSource/[email protected]
|
|
0 commit comments