-
-
Notifications
You must be signed in to change notification settings - Fork 4
38 lines (36 loc) · 1.36 KB
/
merge.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
name: Merge
on:
pull_request_review:
types: [submitted]
jobs:
merge:
permissions:
contents: write
pull-requests: write
if:
github.event.review.state == 'approved' &&
(
github.event.review.author_association == 'OWNER' ||
github.event.review.author_association == 'MEMBER' ||
github.event.review.author_association == 'COLLABORATOR'
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Git config
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Rebase to target branch when needed in order to fast-forward merge
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}
git rebase origin/${{ github.event.pull_request.base.ref }}
- name: Push back source branch (head)
run: |
git push "${{ github.event.pull_request.head.repo.clone_url }}" HEAD:${{ github.event.pull_request.head.ref }} --force
- name: Push to target branch (base)
run: |
# git push "${{ github.event.pull_request.base.repo.clone_url }}" ${{ github.event.pull_request.base.ref }}
git push origin HEAD:${{ github.event.pull_request.base.ref }}