Skip to content

Commit f1bf062

Browse files
committed
feat: make check_branch the first step of sync-dev-to-main
1 parent 8544d2a commit f1bf062

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

.github/workflows/sync-dev-to-main.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ jobs:
1515
merge_success: ${{ steps.merge.outputs.merge_success }}
1616

1717
steps:
18+
- name: Check if dev branch exists
19+
run: |
20+
if git ls-remote --heads https://github.com/${{ github.repository }}.git | grep -q "refs/heads/dev"; then
21+
echo "::notice::Dev branch exists, proceeding with sync"
22+
else
23+
echo "::notice::Dev branch does not exist, skipping sync"
24+
exit 1
25+
fi
26+
1827
- name: Checkout repository
1928
uses: actions/checkout@v4
2029
with:
@@ -26,21 +35,6 @@ jobs:
2635
git config --global user.name "github-actions[bot]"
2736
git config --global user.email "github-actions[bot]@users.noreply.github.com"
2837
29-
- name: Check if dev branch exists
30-
id: check_dev
31-
run: |
32-
if git show-ref --verify --quiet refs/remotes/origin/dev; then
33-
echo "dev_exists=true" >> $GITHUB_OUTPUT
34-
else
35-
echo "dev_exists=false" >> $GITHUB_OUTPUT
36-
fi
37-
38-
- name: Exit if dev branch doesn't exist
39-
if: steps.check_dev.outputs.dev_exists == 'false'
40-
run: |
41-
echo "Dev branch does not exist. Skipping sync."
42-
exit 0
43-
4438
- name: Check for changes between dev and main
4539
id: check_changes
4640
run: |

0 commit comments

Comments
 (0)