diff --git a/.github/workflows/python-test-coverage-report.yml b/.github/workflows/python-test-coverage-report.yml index e09d9c8870..92e13f9168 100644 --- a/.github/workflows/python-test-coverage-report.yml +++ b/.github/workflows/python-test-coverage-report.yml @@ -34,9 +34,16 @@ jobs: # 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 "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + if [ ! -s pr_number ]; then + echo "PR number file 'pr_number' is missing or empty" + exit 1 + fi + PR_NUMBER=$(head -1 pr_number | tr -dc '0-9') + if [ -z "$PR_NUMBER" ]; then + echo "PR number file 'pr_number' does not contain a valid PR number" + exit 1 + fi + echo "PR_NUMBER=$PR_NUMBER" >> "$GITHUB_ENV" - name: Pytest coverage comment id: coverageComment uses: MishaKav/pytest-coverage-comment@v1.2.0