Skip to content

Commit 1b6e89f

Browse files
committed
fix again
1 parent bd1556e commit 1b6e89f

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

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

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ jobs:
2121
run: |
2222
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
2323
if [[ "$TARGET_BRANCH" == "devnet-ready" ]]; then
24-
echo "MERGE_BRANCHES=devnet testnet main" >> $GITHUB_ENV
24+
echo "MERGE_BRANCHES='devnet testnet main'" >> $GITHUB_ENV
2525
elif [[ "$TARGET_BRANCH" == "devnet" ]]; then
26-
echo "MERGE_BRANCHES=testnet main" >> $GITHUB_ENV
26+
echo "MERGE_BRANCHES='testnet main'" >> $GITHUB_ENV
2727
elif [[ "$TARGET_BRANCH" == "testnet" ]]; then
28-
echo "MERGE_BRANCHES=main" >> $GITHUB_ENV
28+
echo "MERGE_BRANCHES='main'" >> $GITHUB_ENV
2929
elif [[ "$TARGET_BRANCH" == "main" ]]; then
30-
echo "MERGE_BRANCHES=" >> $GITHUB_ENV # No need to merge anything into main
30+
echo "MERGE_BRANCHES=''" >> $GITHUB_ENV # No need to merge anything into main
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
@@ -41,22 +41,18 @@ jobs:
4141
for branch in $MERGE_BRANCHES; do
4242
echo "Checking merge from $branch into $TARGET_BRANCH..."
4343
44-
# Ensure we are on the target branch and reset to its latest state
44+
# Ensure we are on the target branch and reset to its latest remote state
4545
git checkout $TARGET_BRANCH
4646
git reset --hard origin/$TARGET_BRANCH
4747
48-
# Ensure branch exists before attempting a merge
49-
if ! git show-ref --verify --quiet "refs/remotes/origin/$branch"; then
50-
echo "❌ Branch $branch does not exist on remote, skipping..."
51-
continue
52-
fi
53-
5448
# Merge without committing to check for conflicts
55-
if ! git merge --no-commit --no-ff origin/$branch; then
49+
if git merge --no-commit --no-ff origin/$branch; then
50+
echo "✅ Merge from $branch into $TARGET_BRANCH is clean."
51+
else
5652
echo "❌ Merge conflict detected when merging $branch into $TARGET_BRANCH"
5753
exit 1
5854
fi
5955
60-
# Abort the merge since we are only testing
61-
git merge --abort || true
56+
# Abort merge if one was started, suppressing errors if no merge happened
57+
git merge --abort 2>/dev/null || true
6258
done

0 commit comments

Comments
 (0)