Skip to content

Commit 8e061b7

Browse files
committed
fix
1 parent a4a3aaa commit 8e061b7

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

.github/workflows/require-clean-merges.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
id: set-merge-branches
2121
run: |
2222
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
23+
PR_BRANCH="${{ github.event.pull_request.head.ref }}"
24+
echo "PR_BRANCH=$PR_BRANCH" >> $GITHUB_ENV
25+
2326
if [[ "$TARGET_BRANCH" == "devnet-ready" ]]; then
2427
echo "MERGE_BRANCHES=devnet testnet main" >> $GITHUB_ENV
2528
elif [[ "$TARGET_BRANCH" == "devnet" ]]; then
@@ -35,21 +38,25 @@ jobs:
3538
- name: Check Merge Cleanliness
3639
run: |
3740
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
41+
PR_BRANCH="${{ github.event.pull_request.head.ref }}"
3842
echo "Fetching all branches..."
3943
git fetch --all --prune
4044
45+
echo "Checking out PR branch: $PR_BRANCH"
46+
git checkout $PR_BRANCH
47+
git reset --hard origin/$PR_BRANCH
48+
4149
for branch in $MERGE_BRANCHES; do
42-
echo "Checking merge from $branch into $TARGET_BRANCH..."
50+
echo "Checking merge from $branch into $PR_BRANCH..."
4351
44-
# Ensure we are on the target branch and reset to its latest remote state
45-
git checkout $TARGET_BRANCH
46-
git reset --hard origin/$TARGET_BRANCH
52+
# Ensure PR branch is up to date
53+
git reset --hard origin/$PR_BRANCH
4754
4855
# Merge without committing to check for conflicts
4956
if git merge --no-commit --no-ff origin/$branch; then
50-
echo "✅ Merge from $branch into $TARGET_BRANCH is clean."
57+
echo "✅ Merge from $branch into $PR_BRANCH is clean."
5158
else
52-
echo "❌ Merge conflict detected when merging $branch into $TARGET_BRANCH"
59+
echo "❌ Merge conflict detected when merging $branch into $PR_BRANCH"
5360
exit 1
5461
fi
5562

0 commit comments

Comments
 (0)