-
Notifications
You must be signed in to change notification settings - Fork 21
42 lines (35 loc) · 1.12 KB
/
sync-develop.yml
File metadata and controls
42 lines (35 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Sync Develop with Main
on:
pull_request:
branches:
- main
types: [closed]
jobs:
sync-branches:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0 # Necessário para ter o histórico completo para o rebase
- name: Set up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Sync develop with main
run: |
echo "Waiting 10 seconds for GitHub to stabilize..."
sleep 10
git fetch origin main
# Tenta o rebase, se falhar ele aborta e para o workflow
if ! git rebase origin/main; then
echo "❌ Conflict detected during rebase! Aborting..."
git rebase --abort
exit 1
fi
echo "✅ Rebase successful. Pushing changes..."
git push origin develop --force-with-lease