Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil committed Oct 17, 2023
1 parent 3196124 commit a95e1cc
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/check-by-name.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,30 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
# Using toJSON so it definitely returns a raw string
# Because a `null` would get printed as the empty string otherwise
mergeable=${{ toJSON(github.event.pull_request.mergeable) }}
mergedSha=${{ toJSON(github.event.pull_request.merge_commit_sha) }}
updateInfo() {
}
while [[ "$mergeable" == "null" ]]; do
# GitHub is computing the mergeability of the commit,
# wait a couple seconds before trying again
echo "Unknown mergeable status of the PR, checking again in 5 seconds"
sleep 5
while true; do
echo "Querying the pull request"
prInfo=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/"$GITHUB_REPOSITORY"/pulls/${{ github.event.pull_request.number }})
echo "pr info is $prInfo"
mergeable=$(jq -r .mergeable <<< "$prInfo")
mergedSha=$(jq -r .merge_commit_sha <<< "$prInfo")
if [[ "$mergeable" != "null" ]]; then
break
else
# GitHub is computing the mergeability of the commit,
# wait a couple seconds before trying again
echo "Unknown mergeable status of the PR, checking again in 5 seconds"
sleep 5
fi
done
if [[ "$mergeable" == "true" ]]; then
echo "The PR appears to not have any conflicts, checking the merge commit $mergedSha"
echo "The PR has no merge conflicts, checking the merge commit $mergedSha"
else
echo "The PR has a merge conflict"
exit 1
Expand Down

0 comments on commit a95e1cc

Please sign in to comment.