forked from actions/runner-images
-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (41 loc) · 1.51 KB
/
merge_pull_request.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
name: Merge pull request
on:
repository_dispatch:
types: [merge-pr]
jobs:
Merge_pull_request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve possible conflicts ${{ github.event.client_payload.ReleaseBranchName }} with main
run: |
git config --global user.email "no-reply@github.com"
git config --global user.name "Actions service account"
git checkout ${{ github.event.client_payload.ReleaseBranchName }}-docs
git merge --no-edit --strategy-option=ours main
git push origin ${{ github.event.client_payload.ReleaseBranchName }}-docs
sleep 30
- name: Approve pull request by GitHub-Actions bot
uses: actions/github-script@v7
with:
github-token: ${{secrets.PRAPPROVAL_SECRET}}
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.client_payload.PullRequestNumber }},
event: "APPROVE"
});
- name: Merge pull request for ${{ github.event.client_payload.ReleaseBranchName }}
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.client_payload.PullRequestNumber }},
merge_method: "squash"
})