Skip to content

Commit

Permalink
change: replace (release/ or hotfix/ => develop) merge with pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
0xWOF committed Feb 20, 2023
1 parent 8999d34 commit d9ca044
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
48 changes: 27 additions & 21 deletions .github/workflows/gitflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,24 +307,30 @@ jobs:
--notes '## Changelog'$'\n'"$CHANGELOG"$'\n''---'$'\n' \
--latest
- name: Merge source branch to develop branch
uses: actions/github-script@v6
with:
script: |
github.rest.repos.merge({
owner: context.repo.owner,
repo: context.repo.repo,
base: 'develop',
head: '${{ env.SOURCE_BRANCH }}',
commit_message: 'release: ${{ env.VERSION }} to develop',
})
- name: Remove source branch
uses: actions/github-script@v6
with:
script: |
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'heads/${{ env.SOURCE_BRANCH }}',
})
- name: Create pull request source branch to develop
id: pull-request
env:
GH_TOKEN: ${{ github.token }}
run: |
PULL_REQUEST_NUMBER=$(
gh pr create \
--head '${{ env.SOURCE_BRANCH }}' \
--base 'develop' \
--title 'release: ${{ env.VERSION }} to develop' \
--body 'release: ${{ env.VERSION }} to develop' \
| grep --perl-regexp '\/pull\/\d\d*' --only-matching \
| grep --perl-regexp '\d\d*' --only-matching
)
echo 'PULL_REQUEST_NUMBER='$PULL_REQUEST_NUMBER >> $GITHUB_ENV
- name: Merge pull request source branch to develop
id: pull-request
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr merge ${{ env.PULL_REQUEST_NUMBER }} \
--subject 'release: ${{ env.VERSION }} to develop' \
--admin \
--delete-branch \
--merge \
|| exit 0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.1

- change: replace (release/ or hotfix/ => develop) merge with pull request

## 1.1.0

- fix: solve issue that release/ or hotfix/ branch can not be merged to develop branch when branch protection rules are applied on develop branch
Expand Down

0 comments on commit d9ca044

Please sign in to comment.