Skip to content

Conversation

@qinsoon
Copy link
Member

@qinsoon qinsoon commented Dec 2, 2025

This should fix #1426. I didn't test it, but the retry pattern is the same as in

for n in {1..5}; do
echo "Wait 30s then try merge"
sleep 30
gh pr merge ${{ steps.get-pr.outputs.pr_number }} --auto --repo ${{ inputs.base_repo }} --squash && break
echo "Failed to merge the PR. Retry..."
done

@qinsoon qinsoon requested a review from wks December 3, 2025 03:27
echo "Wait 30s then try get the pull request number"
sleep 30
PR_NUMBER=$(gh pr list --search "${GITHUB_SHA}" --state merged --repo mmtk/mmtk-core --json number --jq '.[0].number')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need to retry, it means something has gone wrong. For the ease of debugging, I suggest we print out the human-readable output before each try, and print out the value of $PR_NUMBER regardless whether it was successful.

Suggested change
PR_NUMBER=$(gh pr list --search "${GITHUB_SHA}" --state merged --repo mmtk/mmtk-core --json number --jq '.[0].number')
echo "Pull request for the commit is below:"
gh pr list --search "${GITHUB_SHA}" --state merged --repo mmtk/mmtk-core
PR_NUMBER=$(gh pr list --search "${GITHUB_SHA}" --state merged --repo mmtk/mmtk-core --json number --jq '.[0].number')
echo "Output pr=$PR_NUMBER"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Collaborator

@wks wks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qinsoon qinsoon enabled auto-merge December 3, 2025 04:32
@qinsoon qinsoon added this pull request to the merge queue Dec 3, 2025
Merged via the queue into mmtk:master with commit 4ef713e Dec 3, 2025
34 checks passed
@qinsoon qinsoon deleted the retry-get-merged-pr branch December 3, 2025 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The get-merged-pr workflow sometimes gets empty output

2 participants