Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions .github/workflows/regenerate-connector-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,24 +231,25 @@ jobs:
- name: Merge PR
if: ${{ steps.commitFiles.outputs.hasChanged == 'true' && inputs.auto-merge == true }}
run: |
checkComplete="0"
while [ "$checkComplete" != "1" ]; do
while true
do
sleep 20
result=$(gh pr view ${{ steps.createPR.outputs.prUrl }} \
--jq '[.statusCheckRollup[] | select((.name == "Run PR Build Workflow / Build") and (.status == "COMPLETED"))][0]' \
--json statusCheckRollup)

allChecks=$(gh pr status --json statusCheckRollup --jq '.currentBranch.statusCheckRollup')
failedCount=$(echo "$allChecks" | jq '[.[] | select(.conclusion == "FAILURE" or .conclusion == "CANCELLED")] | length')
incompleteCount=$(echo "$allChecks" | jq '[.[] | select(.conclusion != "SUCCESS" and .conclusion != "SKIPPED" and .conclusion != "FAILURE" and .conclusion != "CANCELLED")] | length')

if [[ "$failedCount" -gt 0 ]]; then
echo "Some status checks failed or were cancelled."
exit 1
if [[ -z "$result" ]]; then
echo "Waiting for PR Build Workflow to complete..."
continue
fi

if [[ "$incompleteCount" -eq 0 ]]; then
checkComplete="1"
echo "All required checks have passed."
conclusion=$(echo "$result" | jq -r '.conclusion')
if [[ "$conclusion" == "SUCCESS" ]]; then
echo "PR Build Workflow succeeded."
break
else
echo "Waiting for checks to complete... ($incompleteCount remaining)"
echo "PR Build Workflow failed with conclusion: $conclusion"
exit 1
fi
done
sleep 20
Expand Down