diff --git a/.github/workflows/unit_test_report.yaml b/.github/workflows/unit_test_report.yaml index 12a1e9fb565ef..eff032b5337e3 100644 --- a/.github/workflows/unit_test_report.yaml +++ b/.github/workflows/unit_test_report.yaml @@ -1,6 +1,8 @@ name: Upload Unit Test Results on: + # This workflow must be triggered via `workflow_run` to be able to access + # secrets, which is not possible from a workflow triggered by a PR in a fork. workflow_run: workflows: - linux @@ -36,6 +38,12 @@ jobs: console.log('context.payload.workflow_run.pull_requests', context.payload.workflow_run.pull_requests); console.log('context.payload.workflow_run.head_commit', context.payload.workflow_run.head_commit); + // The `download-artifact` action can only access artifacts that + // were uploaded in the same workflow. Since it was not this + // workflow that uploaded the artifacts we must use rest api + // to download them. + // https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, @@ -83,6 +91,7 @@ jobs: # TODO # DD_METRICS: + # Git info DD_GIT_COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} DD_GIT_REPOSITORY_URL: ${{ github.event.repository.git_url }}