diff --git a/.github/workflows/stats-pr.yml b/.github/workflows/stats-pr.yml index 01f354646f..f414b2eae3 100644 --- a/.github/workflows/stats-pr.yml +++ b/.github/workflows/stats-pr.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-24.04-arm steps: - name: Checkout main branch - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: main - name: Download stats report as artifact @@ -21,18 +21,30 @@ jobs: # Run ID of the workflow that uploaded the artifact run-id: ${{ github.event.workflow_run.id }} github-token: ${{ github.token }} + - name: Check if artifact exists + run: | + if [ ! -d stats_current_test_info ]; then + echo "No stats artifact found" + echo "ARTIFACT_EXIST=false" >> "$GITHUB_ENV" + else + echo "Stats artifact found" + echo "ARTIFACT_EXIST=true" >> "$GITHUB_ENV" + fi - name: Move stats file # Unpack the artifact and move the stats file to the correct location + if: env.ARTIFACT_EXIST == 'true' run: | mv stats_current_test_info/stats_current_test_info.yml data/stats_current_test_info.yml rm -rf stats_current_test_info - name: Set workflow link as environment variable + if: env.ARTIFACT_EXIST == 'true' run: echo "WORKFLOW_URL=${{ github.event.workflow_run.workflow_url }}" >> $GITHUB_ENV - name: Echo Workflow URL + if: env.ARTIFACT_EXIST == 'true' run: echo $WORKFLOW_URL - name: Create Pull Request uses: peter-evans/create-pull-request@v6 - if: success() + if: env.ARTIFACT_EXIST == 'true' && success() with: commit-message: Update stats_current_test_info.yml title: Update stats_current_test_info.yml