workflows/eval: fail hard without target run (#378909)

This commit is contained in:
Silvan Mosberger
2025-02-04 10:36:53 +01:00
committed by GitHub

View File

@@ -171,11 +171,11 @@ jobs:
run: | run: |
# Get the latest eval.yml workflow run for the PR's target commit # Get the latest eval.yml workflow run for the PR's target commit
if ! run=$(gh api --method GET /repos/"$REPOSITORY"/actions/workflows/eval.yml/runs \ if ! run=$(gh api --method GET /repos/"$REPOSITORY"/actions/workflows/eval.yml/runs \
-f head_sha="$BASE_SHA" -f event=push \ -f head_sha="$TARGET_SHA" -f event=push \
--jq '.workflow_runs | sort_by(.run_started_at) | .[-1]') \ --jq '.workflow_runs | sort_by(.run_started_at) | .[-1]') \
|| [[ -z "$run" ]]; then || [[ -z "$run" ]]; then
echo "Could not find an eval.yml workflow run for $BASE_SHA, cannot make comparison" echo "Could not find an eval.yml workflow run for $TARGET_SHA, cannot make comparison"
exit 0 exit 1
fi fi
echo "Comparing against $(jq .html_url <<< "$run")" echo "Comparing against $(jq .html_url <<< "$run")"
runId=$(jq .id <<< "$run") runId=$(jq .id <<< "$run")
@@ -189,13 +189,13 @@ jobs:
if [[ "$conclusion" != "success" ]]; then if [[ "$conclusion" != "success" ]]; then
echo "Workflow was not successful (conclusion: $conclusion), cannot make comparison" echo "Workflow was not successful (conclusion: $conclusion), cannot make comparison"
exit 0 exit 1
fi fi
echo "targetRunId=$runId" >> "$GITHUB_OUTPUT" echo "targetRunId=$runId" >> "$GITHUB_OUTPUT"
env: env:
REPOSITORY: ${{ github.repository }} REPOSITORY: ${{ github.repository }}
BASE_SHA: ${{ needs.attrs.outputs.targetSha }} TARGET_SHA: ${{ needs.attrs.outputs.targetSha }}
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4