-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (35 loc) · 1.42 KB
/
sync_develop_and_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
name: Create PR from main to develop
on:
workflow_call:
secrets:
caller_github_token:
required: true
permissions:
contents: write
pull-requests: write
jobs:
create_pull_request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract version and merge branch name
id: vars
run: |
PACKAGE_VERSION="v$(cat ./package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')"
COMMIT_HASH="$(git rev-parse --short HEAD)"
echo tag=${PACKAGE_VERSION} >> $GITHUB_OUTPUT
echo merge_branch_name="dev/merge-${PACKAGE_VERSION}-${COMMIT_HASH}-into-develop" >> $GITHUB_OUTPUT
- name: Create merge branch
uses: peterjgrainger/[email protected]
with:
branch: ${{ steps.vars.outputs.merge_branch_name }}
env:
GITHUB_TOKEN: ${{ secrets.caller_github_token }}
- name: Create pull request
uses: repo-sync/pull-request@v2
with:
source_branch: "${{ steps.vars.outputs.merge_branch_name }}"
destination_branch: "develop"
pr_title: "Merge ${{ github.event.repository.default_branch }} (${{ steps.vars.outputs.tag }}) into develop"
pr_body: "Merge ${{ github.event.repository.default_branch }} (${{ steps.vars.outputs.tag }}) into develop"
github_token: ${{ secrets.caller_github_token }}