Skip to content

Commit 1ed6a9c

Browse files
committed
fixes
1 parent 74be0ea commit 1ed6a9c

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

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

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,36 @@ jobs:
2121
run: |
2222
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
2323
if [[ "$TARGET_BRANCH" == "devnet-ready" ]]; then
24-
echo "MERGE_BRANCHES=devnet-ready devnet testnet main" >> $GITHUB_ENV
24+
echo "MERGE_BRANCHES='devnet testnet main'" >> $GITHUB_ENV
2525
elif [[ "$TARGET_BRANCH" == "devnet" ]]; then
26-
echo "MERGE_BRANCHES=devnet testnet main" >> $GITHUB_ENV
26+
echo "MERGE_BRANCHES='testnet main'" >> $GITHUB_ENV
2727
elif [[ "$TARGET_BRANCH" == "testnet" ]]; then
28-
echo "MERGE_BRANCHES=testnet main" >> $GITHUB_ENV
28+
echo "MERGE_BRANCHES='main'" >> $GITHUB_ENV
2929
elif [[ "$TARGET_BRANCH" == "main" ]]; then
30-
echo "MERGE_BRANCHES=main" >> $GITHUB_ENV
30+
echo "MERGE_BRANCHES=''" >> $GITHUB_ENV
3131
else
32-
echo "MERGE_BRANCHES=devnet-ready devnet testnet main" >> $GITHUB_ENV
32+
echo "MERGE_BRANCHES='devnet-ready devnet testnet main'" >> $GITHUB_ENV
3333
fi
3434
3535
- name: Check Merge Cleanliness
3636
run: |
37+
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
38+
echo "Fetching all branches..."
39+
git fetch --all --prune
40+
3741
for branch in $MERGE_BRANCHES; do
38-
echo "Checking merge from $branch into ${{ github.event.pull_request.base.ref }}..."
39-
git fetch origin $branch
40-
git checkout ${{ github.event.pull_request.base.ref }}
42+
echo "Checking merge from $branch into $TARGET_BRANCH..."
43+
44+
# Ensure we are on the target branch
45+
git checkout $TARGET_BRANCH
46+
git reset --hard origin/$TARGET_BRANCH
47+
48+
# Merge without committing to check for conflicts
4149
if ! git merge --no-commit --no-ff origin/$branch; then
42-
echo "Merge conflict detected when merging $branch into ${{ github.event.pull_request.base.ref }}"
50+
echo "Merge conflict detected when merging $branch into $TARGET_BRANCH"
4351
exit 1
4452
fi
45-
git merge --abort
53+
54+
# Abort the merge since we are only testing
55+
git merge --abort || true
4656
done

0 commit comments

Comments
 (0)