Skip to content

Commit 550ce3c

Browse files
committed
fix: improve backmerge workflow with better diff detection and debugging
1 parent d472d93 commit 550ce3c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/pr-backmerge.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,27 @@ jobs:
3131
# This gives the workflow access to the repository contents
3232
- name: Checkout repository
3333
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0 # Fetch all history for proper branch comparison
3436

3537
# Step 1.5: Ensure we have the latest develop branch and check if there are differences
3638
- name: Fetch develop branch
37-
run: git fetch origin develop:develop
39+
run: |
40+
git fetch origin develop:develop
41+
git branch -a
42+
echo "Current branch: $(git branch --show-current)"
43+
echo "Develop branch commit: $(git rev-parse develop)"
44+
echo "Main branch commit: $(git rev-parse main)"
3845
3946
- name: Check for differences between main and develop
4047
id: check_diff
4148
run: |
42-
git diff --quiet main develop || echo "has_diff=true" >> $GITHUB_OUTPUT
43-
echo "Checking differences between main and develop branches..."
4449
if git diff --quiet main develop; then
4550
echo "No differences found between main and develop branches."
51+
echo "has_diff=false" >> $GITHUB_OUTPUT
4652
else
4753
echo "Found differences between main and develop branches."
54+
echo "has_diff=true" >> $GITHUB_OUTPUT
4855
fi
4956
5057
# Step 2: Create an automated pull request for the backmerge
@@ -76,8 +83,10 @@ jobs:
7683
- name: PR Creation Status
7784
if: always()
7885
run: |
86+
echo "has_diff value: ${{ steps.check_diff.outputs.has_diff }}"
7987
if [ "${{ steps.check_diff.outputs.has_diff }}" != 'true' ]; then
8088
echo "No PR created because there are no differences between main and develop branches."
8189
else
8290
echo "PR creation attempted. If no PR was created, check GitHub token permissions."
91+
echo "GitHub token permissions: ${{ toJson(github.token_permissions) }}"
8392
fi

0 commit comments

Comments
 (0)