20
20
id : set-merge-branches
21
21
run : |
22
22
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
+
23
26
if [[ "$TARGET_BRANCH" == "devnet-ready" ]]; then
24
27
echo "MERGE_BRANCHES=devnet testnet main" >> $GITHUB_ENV
25
28
elif [[ "$TARGET_BRANCH" == "devnet" ]]; then
@@ -35,21 +38,25 @@ jobs:
35
38
- name : Check Merge Cleanliness
36
39
run : |
37
40
TARGET_BRANCH="${{ github.event.pull_request.base.ref }}"
41
+ PR_BRANCH="${{ github.event.pull_request.head.ref }}"
38
42
echo "Fetching all branches..."
39
43
git fetch --all --prune
40
44
45
+ echo "Checking out PR branch: $PR_BRANCH"
46
+ git checkout $PR_BRANCH
47
+ git reset --hard origin/$PR_BRANCH
48
+
41
49
for branch in $MERGE_BRANCHES; do
42
- echo "Checking merge from $branch into $TARGET_BRANCH ..."
50
+ echo "Checking merge from $branch into $PR_BRANCH ..."
43
51
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
47
54
48
55
# Merge without committing to check for conflicts
49
56
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."
51
58
else
52
- echo "❌ Merge conflict detected when merging $branch into $TARGET_BRANCH "
59
+ echo "❌ Merge conflict detected when merging $branch into $PR_BRANCH "
53
60
exit 1
54
61
fi
55
62
0 commit comments