13
13
- name : Checkout
14
14
uses : actions/checkout@v2
15
15
16
- - name : Create auto-merge Label (if missing)
17
- uses : actions-ecosystem/action-create-label@v1
18
- with :
19
- github_token : ${{ secrets.PERSONAL_TOKEN }}
20
- label : auto-merge
21
- color : ' #0e8a16'
22
- description : ' Auto-merge PRs with this label'
23
-
24
16
- name : Sync Branches (Create PR)
25
17
uses : tretuna/sync-branches@1.4.0
26
18
with :
@@ -31,16 +23,30 @@ jobs:
31
23
PULL_REQUEST_BODY : " Automated PR to sync dev to stage."
32
24
PULL_REQUEST_LABELS : " auto-merge"
33
25
34
- auto-merge :
26
+ sync-dev-to-stage :
35
27
runs-on : ubuntu-latest
36
- needs : sync-branches
37
-
38
28
steps :
39
- - name : Auto-Merge PR
40
- uses : peter-evans/merge-pull-request @v3
29
+ - name : Checkout Repository
30
+ uses : actions/checkout @v3
41
31
with :
42
- token : ${{ secrets.PERSONAL_TOKEN }}
43
- merge-method : squash # Change to merge, squash, or rebase
44
- labels : auto-merge
45
- commit-title : " Auto-merged dev into stage"
46
- commit-message : " Automatically merged PR from dev to stage."
32
+ token : ${{ secrets.GITHUB_TOKEN }}
33
+ fetch-depth : 0
34
+
35
+ - name : Set up Git identity
36
+ run : |
37
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
38
+ git config --local user.name "github-actions[bot]"
39
+
40
+ - name : Fetch latest changes from origin
41
+ run : |
42
+ git fetch origin --prune
43
+
44
+ - name : Checkout stage branch and merge dev into it
45
+ run : |
46
+ git checkout stage || git checkout -b stage
47
+ git pull origin stage --ff-only || true
48
+ git merge --no-ff dev || true
49
+
50
+ - name : Push changes to origin/stage branch
51
+ run : |
52
+ git push origin stage --force-with-lease || echo "No changes to push"
0 commit comments