diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 14a9e79d3..73816ed7a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -120,29 +120,17 @@ jobs: echo "Storing commit SHA ${{ github.event.pull_request.head.sha }}" echo "${{ github.event.pull_request.head.sha }}" > commit_sha.txt - # Workaround for https://github.com/orgs/community/discussions/25220 - # Triggered sub-workflow is not able to detect the original commit/PR which is available - # in this workflow. - - name: Store PR number in artifacts - uses: actions/upload-artifact@v4 - with: - name: pr_number - path: pr_number.txt - - - name: Store commit SHA in artifacts - uses: actions/upload-artifact@v4 - with: - name: commit_sha - path: commit_sha.txt - - # This stores the coverage report in artifacts. The actual upload to Codecov - # is executed by a different workflow `upload_coverage.yml`. The reason for this - # split is because `on.pull_request` workflows don't have access to secrets. + # This stores the coverage report and metadata in artifacts. + # The actual upload to Codecov is executed by a different workflow `upload_coverage.yml`. + # The reason for this split is because `on.pull_request` workflows don't have access to secrets. - name: Store coverage report in artifacts uses: actions/upload-artifact@v4 with: name: codecov_report - path: codecov_report.json + path: | + codecov_report.json + pr_number.txt + commit_sha.txt - run: | echo 'The coverage report was stored in Github artifacts.' diff --git a/.github/workflows/upload_coverage.yml b/.github/workflows/upload_coverage.yml index 55a2f1269..ef730e86a 100644 --- a/.github/workflows/upload_coverage.yml +++ b/.github/workflows/upload_coverage.yml @@ -46,43 +46,9 @@ jobs: }); fs.writeFileSync('codecov_report.zip', Buffer.from(download.data)); - let prNumber = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "pr_number"; - }); - - if (prNumber.length != 1) { - throw new Error("Unexpected number of {pr_number} artifacts: " + prNumber.length); - } - - var download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: prNumber[0].id, - archive_format: 'zip', - }); - fs.writeFileSync('pr_number.zip', Buffer.from(download.data)); - - let commitSha = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "commit_sha"; - }); - - if (commitSha.length != 1) { - throw new Error("Unexpected number of {commit_sha} artifacts: " + commitSha.length); - } - - var download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: commitSha[0].id, - archive_format: 'zip', - }); - fs.writeFileSync('commit_sha.zip', Buffer.from(download.data)); - - id: parse_previous_artifacts run: | unzip codecov_report.zip - unzip pr_number.zip - unzip commit_sha.zip echo "Detected PR is: $(