-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (51 loc) · 1.63 KB
/
create-pr-to-main.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
name: Create PR to Main on release
on:
workflow_call:
inputs:
target_branch:
required: true
type: string
description: "Branch to create a pr for"
tag_name:
required: false
type: string
prerelease:
required: false
type: boolean
jobs:
debug:
runs-on: ubuntu-latest
steps:
run: |
echo "target_branch: ${{ inputs.target_branch }}"
echo "tag_name: ${{ inputs.tag_name }}"
echo "prerelease: ${{ inputs.prerelease }}"
create-pr-to-main-on-release:
if: inputs.target_branch == 'main'
runs-on: ubuntu-latest
steps:
- name: Abort if it's not a pre-release
if: inputs.prerelease == false
run: exit 1
- name: Checkout test branch
uses: actions/checkout@v3
with:
ref: 'test'
- name: Create Pull Request from tag branch to main
run: |
gh pr create --title "Release ${{ inputs.tag_name }}" --body "Release ${{ inputs.tag_name }}" --base main --head test --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create-pr-to-sync-with-main:
if: inputs.target_branch != 'main'
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: 'main'
- name: Create Pull Request from main to test
run: |
gh pr create --title "Sync ${{ inputs.target_branch }} with main" --base ${{ inputs.target_branch }} --head main --repo ${{ github.repository }} --label "sync"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}