-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (47 loc) · 1.46 KB
/
merge_branch.yml
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
43
44
45
46
47
48
49
50
51
52
53
54
name: merge branch
on:
workflow_call:
inputs:
repo:
type: string
required: true
checkout_branch:
type: string
required: true
merge_from_branch:
type: string
required: true
secrets:
gh_token:
required: true
gh_user:
required: true
gh_email:
required: true
env:
GH_TOKEN: ${{ secrets.gh_token }}
jobs:
merge-to-main:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout ${{ inputs.checkout_branch }}
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_branch }}
fetch-depth: 0
- name: 🔑 Set Bot Authentication
run: |
git config --global user.name "${{ secrets.gh_user }}"
git config --global user.email "${{ secrets.gh_email }}"
- name: 🔀 Merge ${{ inputs.merge_from_branch }} -> ${{ inputs.checkout_branch }}
run: |
git pull origin ${{ inputs.merge_from_branch }}
git merge --no-ff origin/${{ inputs.merge_from_branch }} -m "[Automated] Merged ${{ inputs.merge_from_branch }} -> ${{ inputs.checkout_branch }}"
# TODO implement this using gh command
- name: 🔏 Push to protected ${{ inputs.checkout_branch }} branch
uses: CasperWA/[email protected]
with:
token: ${{ secrets.gh_token }}
branch: ${{ inputs.checkout_branch }}
tags: false
unprotect_reviews: false