This repository has been archived by the owner on Sep 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 238
66 lines (57 loc) · 2 KB
/
sync-main-for-develop.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
55
56
57
58
59
60
61
62
63
64
65
66
name: sync main for develop
on:
schedule:
- cron: "0 19 * * *" # run at 4 AM JST
workflow_dispatch:
env:
BASE_BRANCH: develop
SYNC_TARGET_BRANCH: main
SYNC_BRANCH: sync-main-for-develop
jobs:
sync-main-for-develop:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ env.BASE_BRANCH }}
fetch-depth: 0
- name: Generate token
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
# To keep the base branch in "create-pull-request", checkout with "BASE_BRANCH" and reset to "SYNC_TARGET_BRANCH"
- name: Reset to sync target branch
run: |
git reset --hard origin/${{ env.SYNC_TARGET_BRANCH }}
- name: Create PR
id: create_pr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: sync main for develop
committer: GitHub <[email protected]>
author: GitHub <[email protected]>
signoff: false
base: ${{ env.BASE_BRANCH }}
branch: ${{ env.SYNC_BRANCH }}
delete-branch: true
title: sync main for develop
body: |
sync main for develop
labels: |
sync-main-for-develop
draft: false
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.create_pr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.create_pr.outputs.pull-request-url }}"
- name: Enable Auto-merge
if: steps.create_pr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v1
with:
token: ${{ steps.generate-token.outputs.token }}
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }}
merge-method: merge