|
1 | 1 | ## Merge branch action
|
2 | 2 |
|
3 |
| -### On labeled |
| 3 | +Runs a git merge in your CI. |
4 | 4 |
|
5 |
| -Merge pull request branch using GitHub labels. |
| 5 | +Examples: |
6 | 6 |
|
7 |
| -When you set a label in a pull request this action can merge the pull request branch to other branch, useful for develop branch or staging environments. |
8 |
| - |
9 |
| - |
10 |
| - |
| 7 | +### Sync branches |
11 | 8 |
|
12 | 9 | ```yaml
|
13 |
| -name: Merge branch |
| 10 | +name: Sync multiple branches |
14 | 11 | on:
|
15 |
| - pull_request: |
16 |
| - types: [labeled] |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - '*' |
17 | 15 | jobs:
|
18 |
| - merge-branch: |
| 16 | + sync-branch: |
19 | 17 | runs-on: ubuntu-latest
|
20 | 18 | steps:
|
21 | 19 | - uses: actions/checkout@master
|
22 |
| - - name: Merge by labeled |
23 |
| - |
| 20 | + |
| 21 | + - name: Merge development -> staging |
| 22 | + |
24 | 23 | with:
|
25 |
| - label_name: 'merged in develop' |
26 |
| - target_branch: 'develop' |
| 24 | + type: now |
| 25 | + from_branch: development |
| 26 | + target_branch: staging |
| 27 | + env: |
| 28 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 29 | + |
| 30 | + - name: Merge staging -> uat |
| 31 | + |
| 32 | + with: |
| 33 | + type: now |
| 34 | + from_branch: staging |
| 35 | + target_branch: uat |
27 | 36 | env:
|
28 | 37 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
29 | 38 | ```
|
30 | 39 |
|
31 |
| -## On any GitHub event |
| 40 | +### Merge current branch |
32 | 41 |
|
33 | 42 | ```yaml
|
34 |
| -name: Merge staging branch to uat |
| 43 | +name: Merge any release branch to uat |
35 | 44 | on:
|
36 | 45 | push:
|
37 | 46 | branches:
|
38 |
| - - 'staging' |
| 47 | + - 'release/*' |
39 | 48 | jobs:
|
40 | 49 | merge-branch:
|
41 | 50 | runs-on: ubuntu-latest
|
42 | 51 | steps:
|
43 | 52 | - uses: actions/checkout@master
|
44 |
| - - name: Merge to uat branch |
45 |
| - |
| 53 | + |
| 54 | + - name: Merge staging -> uat |
| 55 | + |
46 | 56 | with:
|
47 | 57 | type: now
|
48 |
| - target_branch: 'uat' |
| 58 | + target_branch: uat |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 61 | +``` |
| 62 | +
|
| 63 | +### On labeled |
| 64 | +
|
| 65 | +Merge pull request branch using GitHub labels. |
| 66 | +
|
| 67 | +When you set a label in a pull request this action can merge the pull request branch to other branch, useful for develop branch or staging environments. |
| 68 | +
|
| 69 | + |
| 70 | + |
| 71 | +
|
| 72 | +```yaml |
| 73 | +name: Merge branch with labeled |
| 74 | +on: |
| 75 | + pull_request: |
| 76 | + types: [labeled] |
| 77 | +jobs: |
| 78 | + merge-branch: |
| 79 | + runs-on: ubuntu-latest |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@master |
| 82 | + |
| 83 | + - name: Merge by labeled |
| 84 | + |
| 85 | + with: |
| 86 | + label_name: 'merged in develop' |
| 87 | + target_branch: 'develop' |
49 | 88 | env:
|
50 | 89 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
51 | 90 | ```
|
0 commit comments