From 3ddd8c06b66cc63d956b199708f8a2506ef06538 Mon Sep 17 00:00:00 2001 From: Kartik Pradeepan Date: Thu, 31 Oct 2024 09:36:41 -0400 Subject: [PATCH] Debug map_new_plugins.yml --- .github/workflows/map_new_plugins.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/map_new_plugins.yml b/.github/workflows/map_new_plugins.yml index 8260d872d..a4dde835e 100644 --- a/.github/workflows/map_new_plugins.yml +++ b/.github/workflows/map_new_plugins.yml @@ -33,19 +33,26 @@ jobs: completed_checks=0 echo "Using github PR head sha: ${{ github.event.pull_request.head.sha }}" - echo "Option to use github sha: ${{ github.sha }}" # Fetch the status of all checks for this commit statuses=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ "https://api.github.com/repos/brain-score/vision/commits/${{ github.event.pull_request.head.sha }}/status" | jq -r '.statuses[] | {context: .context, state: .state}') + + echo "Statuses response from GitHub API:" + echo "$statuses" | jq '.' - # Check if both required jobs are marked as 'success' + # Parse the statuses and check each required job for success for check in "${required_checks[@]}"; do - if echo "$statuses" | grep -q "$check.*success"; then + if echo "$statuses" | jq -e --arg check "$check" '.statuses[] | select(.context == $check) | select(.state == "success")' > /dev/null; then + echo "Job '$check' is successful." ((completed_checks+=1)) + else + echo "Job '$check' is NOT successful." fi done - + + echo "Completed checks: $completed_checks / ${#required_checks[@]}" + # Fail this step if not all required jobs are completed if [ "$completed_checks" -ne "${#required_checks[@]}" ]; then echo "Not all required Jenkins jobs are complete. Exiting."