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