1name: ready to merge 2 3on: 4 workflow_call: 5 inputs: 6 needs_context: 7 type: string 8 required: true 9 10jobs: 11 all_jobs_passed: 12 name: all jobs passed 13 runs-on: ubuntu-latest 14 steps: 15 - name: "Check status of all required jobs" 16 run: |- 17 NEEDS_CONTEXT='${{ inputs.needs_context }}' 18 JOB_IDS=$(echo "$NEEDS_CONTEXT" | jq -r 'keys[]') 19 for JOB_ID in $JOB_IDS; do 20 RESULT=$(echo "$NEEDS_CONTEXT" | jq -r ".[\"$JOB_ID\"].result") 21 echo "$JOB_ID job result: $RESULT" 22 if [[ $RESULT != "success" && $RESULT != "skipped" ]]; then 23 echo "***" 24 echo "Error: The $JOB_ID job did not pass." 25 exit 1 26 fi 27 done 28 echo "All jobs passed or were skipped." 29