-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (38 loc) · 1.53 KB
/
merge-development.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
# https://www.jessesquires.com/blog/2022/03/26/gh-action-merge-release-to-main/
name: Merge development into main
on:
workflow_dispatch:
inputs:
ci:
description: "CI"
required: false
default: "docker-compose-build.yml"
jobs:
main:
name: Pull request into main
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Check CI status
run: |
output=$(curl -sSL -X GET -G -H "Accept: application/vnd.github.v3+json" -d "branch=${{ env.GITHUB_REF_SLUG }}" -d "event=push" https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ github.event.inputs.ci }}/runs | jq -r '.workflow_runs[0] | "\(.conclusion)"')
echo "::set-output name=status::$output"
id: check
- name: Abort if CI not successful
if: steps.check.outputs.status != 'success'
run: |
echo ${{ steps.check.outputs.status }}
exit 1
- name: Create pull request
id: open-pr
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_branch: ${{ github.event.repository.default_branch }}
pr_title: "[Automated] Merge ${{ github.ref_name }} into ${{ github.event.repository.default_branch }}"
pr_body: "Automated Pull Request"