@@ -21,15 +21,15 @@ jobs:
21
21
run : |
22
22
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
23
23
if [[ "$TARGET_BRANCH" == "devnet-ready" ]]; then
24
- echo "MERGE_BRANCHES=devnet testnet main" >> $GITHUB_ENV
24
+ echo "MERGE_BRANCHES=' devnet testnet main' " >> $GITHUB_ENV
25
25
elif [[ "$TARGET_BRANCH" == "devnet" ]]; then
26
- echo "MERGE_BRANCHES=testnet main" >> $GITHUB_ENV
26
+ echo "MERGE_BRANCHES=' testnet main' " >> $GITHUB_ENV
27
27
elif [[ "$TARGET_BRANCH" == "testnet" ]]; then
28
- echo "MERGE_BRANCHES=main" >> $GITHUB_ENV
28
+ echo "MERGE_BRANCHES=' main' " >> $GITHUB_ENV
29
29
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
31
31
else
32
- echo "MERGE_BRANCHES=devnet-ready devnet testnet main" >> $GITHUB_ENV
32
+ echo "MERGE_BRANCHES=' devnet-ready devnet testnet main' " >> $GITHUB_ENV
33
33
fi
34
34
35
35
- name : Check Merge Cleanliness
@@ -41,22 +41,18 @@ jobs:
41
41
for branch in $MERGE_BRANCHES; do
42
42
echo "Checking merge from $branch into $TARGET_BRANCH..."
43
43
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
45
45
git checkout $TARGET_BRANCH
46
46
git reset --hard origin/$TARGET_BRANCH
47
47
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
-
54
48
# 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
56
52
echo "❌ Merge conflict detected when merging $branch into $TARGET_BRANCH"
57
53
exit 1
58
54
fi
59
55
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
62
58
done
0 commit comments