diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 76020bab..289e605f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -12,14 +12,29 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - name: Download build artifact from triggered workflow - uses: dawidd6/action-download-artifact@v2 + - name: download coverage artifact + uses: actions/github-script@v6 with: - run_id: ${{ github.event.workflow_run.id }} - name: coverage-report - search_artifacts: true + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "coverage" + })[0]; + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverage.zip`, Buffer.from(download.data)); + + - name: unzip artifact + run: unzip coverage.zip - name: run codacy-coverage-reporter uses: codacy/codacy-coverage-reporter-action@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 873e9e46..6bf7defd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,5 +60,5 @@ jobs: name: upload coverage report uses: actions/upload-artifact@v3 with: - name: coverage-report + name: coverage path: coverage.xml