diff --git a/.github/workflows/python-test-coverage-report.yml b/.github/workflows/python-test-coverage-report.yml index 7f0d323bb710..67c848609f6b 100644 --- a/.github/workflows/python-test-coverage-report.yml +++ b/.github/workflows/python-test-coverage-report.yml @@ -25,10 +25,19 @@ jobs: merge-multiple: true - name: Display structure of downloaded files run: ls + - name: Read and set PR number + # Need to read the PR number from the file saved in the previous workflow + # because the workflow_run event does not have access to the PR number + # The PR number is needed to post the comment on the PR + run: | + PR_NUMBER=$(cat pr_number) + echo "PR number: $PR_NUMBER" + echo "::set-env name=PR_NUMBER::$PR_NUMBER" - name: Pytest coverage comment id: coverageComment uses: MishaKav/pytest-coverage-comment@main with: + issue-number: ${{ env.PR_NUMBER }} pytest-coverage-path: python/python-coverage.txt title: "Python Test Coverage Report" badge-title: "Python Test Coverage" diff --git a/.github/workflows/python-test-coverage.yml b/.github/workflows/python-test-coverage.yml index 7ffc9925fb34..5d67b29b6b12 100644 --- a/.github/workflows/python-test-coverage.yml +++ b/.github/workflows/python-test-coverage.yml @@ -21,6 +21,11 @@ jobs: UV_PYTHON: "3.10" steps: - uses: actions/checkout@v4 + # Save the PR number to a file since the workflow_run event + # in the coverage report workflow does not have access to it + - name: Save PR number + run: | + echo ${{ github.event.number }} > ./pr_number - name: Set up uv uses: astral-sh/setup-uv@v4 with: @@ -37,6 +42,7 @@ jobs: path: | python/python-coverage.txt python/pytest.xml + python/pr_number overwrite: true retention-days: 1 if-no-files-found: error