@@ -21,26 +21,36 @@ 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-ready 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=devnet testnet main" >> $GITHUB_ENV
26
+ echo "MERGE_BRANCHES=' testnet main' " >> $GITHUB_ENV
27
27
elif [[ "$TARGET_BRANCH" == "testnet" ]]; then
28
- echo "MERGE_BRANCHES=testnet main" >> $GITHUB_ENV
28
+ echo "MERGE_BRANCHES=' main' " >> $GITHUB_ENV
29
29
elif [[ "$TARGET_BRANCH" == "main" ]]; then
30
- echo "MERGE_BRANCHES=main " >> $GITHUB_ENV
30
+ echo "MERGE_BRANCHES='' " >> $GITHUB_ENV
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
36
36
run : |
37
+ TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
38
+ echo "Fetching all branches..."
39
+ git fetch --all --prune
40
+
37
41
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
41
49
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 "
43
51
exit 1
44
52
fi
45
- git merge --abort
53
+
54
+ # Abort the merge since we are only testing
55
+ git merge --abort || true
46
56
done
0 commit comments