Skip to content

Commit 089f7d4

Browse files
committed
move git-fetch within if statement
1 parent 3aece12 commit 089f7d4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/sync-branches.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414

1515
- name: Check Main Branch Status
1616
run: |
17-
git fetch origin/main
18-
local_ref=$(git rev-parse HEAD)
19-
remote_ref=$(git rev-parse origin)
17+
local_ref=$(git rev-parse main)
18+
remote_ref=$(git rev-parse origin/main)
2019
if [ "$local_ref" != "$remote_ref" ]; then
2120
echo "HEAD is behind origin/main. Merging..."
21+
git fetch origin/main
2222
git merge origin/main -m "Actions workflow: auto-merge origin/main -> main"
2323
fi
2424

0 commit comments

Comments
 (0)