Skip to content

Commit 03f2435

Browse files
authored
feat(workflow-auto-merge-release-hotfix-into-develop): add new workflow for auto merging release/hotfix into develop (#26)
2 parents 6d0c51b + c9d2c41 commit 03f2435

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: auto_merge_into_develop
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
branches:
8+
- develop
9+
10+
env:
11+
BRANCH_DEVELOP: develop
12+
13+
jobs:
14+
auto_merge_into_develop:
15+
name: Merge release into develop
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
# only merge pull requests that begin with 'release/' or 'hotfix/'
20+
if: startsWith(github.head_ref, 'release/') || startsWith(github.head_ref, 'hotfix/')
21+
22+
steps:
23+
- name: Merge PR
24+
env:
25+
PR_NUMBER: ${{ github.event.number }}
26+
PR_TITLE: Merge branch '${{ github.head_ref }}' into ${{ env.BRANCH_DEVELOP }}
27+
run: |
28+
gh pr merge ${PR_NUMBER} -m -d -t "${PR_TITLE}"

.github/workflows/release.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,3 @@ jobs:
7777
--body "${{ env.PR_BODY }}" \
7878
--label "${{ env.PR_LABEL }}" \
7979
--fill
80-
81-
PR_ID=$(gh pr list --state open --search "base:${{ env.BRANCH_DEVELOP }} head:${{ github.head_ref }}" | head -1 | cut -f1)
82-
[[ ! -z "$PR_ID" ]] && gh pr merge ${PR_ID} -m -d -t "${{ env.PR_TITLE }}" || echo "Empty PR ID. Ignored!"

0 commit comments

Comments
 (0)