Skip to content

Commit ec958fd

Browse files
committed
refs or cleanup
1 parent 0e57a41 commit ec958fd

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎.github/workflows/merge-dependabot.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
# Dependabot records the update type in its commit message metadata, for example
2626
# "update-type: version-update:semver-minor". A grouped bump lists one per dependency.
2727
# --match-head-commit refuses the merge if the branch moved after this build ran.
28+
# A bump that conflicts with main (an earlier bump merged an adjacent line) is skipped:
29+
# Dependabot rebases it, the rebase reruns Build, and that run triggers this workflow again.
30+
# GitHub computes mergeability lazily, so UNKNOWN is retried briefly.
2831
- name: Merge when the bump is minor or patch
2932
env:
3033
GH_TOKEN: ${{ github.token }}
@@ -42,4 +45,13 @@ jobs:
4245
echo "::warning::No open pull request for $BRANCH"
4346
exit 0
4447
fi
48+
for attempt in 1 2 3 4 5 6; do
49+
mergeable=$(gh pr view "$pr" --json mergeable --jq '.mergeable')
50+
[ "$mergeable" != "UNKNOWN" ] && break
51+
sleep 5
52+
done
53+
if [ "$mergeable" = "CONFLICTING" ]; then
54+
echo "::warning::Pull request #$pr conflicts with the base branch, leaving for Dependabot to rebase"
55+
exit 0
56+
fi
4557
gh pr merge "$pr" --squash --match-head-commit "$HEAD_SHA"

0 commit comments

Comments
 (0)