Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix/#123_test #101

Draft
wants to merge 17 commits into
base: 2022-main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/workflows/auto_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,29 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup git
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git config push.default current
- name: Create a pull request
run: |
if ${{ startsWith(github.event.ref, 'release/') }}; then
exit 0
fi
ISSUE=`echo "${{ github.event.ref }}" | grep -oE '#[0-9]+'`
if ${{ startsWith(github.event.ref, 'hotfix/') }}; then
if git diff main ${{ github.event.ref }} --quiet; then
if git diff --quiet origin/main; then
git commit --allow-empty -m "empty commit"
git push
fi
gh pr create --draft --base main --assignee ${{ github.event.sender.login }} --title "${{ github.event.ref }}" --body "close $ISSUE"
else
if git diff develop ${{ github.event.ref }} --quiet; then
if git diff --quiet origin/develop; then
git commit --allow-empty -m "empty commit"
git push
fi
gh pr create --draft --base develop --assignee ${{ github.event.sender.login }} --title "${{ github.event.ref }}" --body "close $ISSUE"
fi
29 changes: 29 additions & 0 deletions .github/workflows/fix-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Fix branch

on:
pull_request:
types:
- opened
- reopened
branches:
- "main"
- "develop"
jobs:
change-base_branch:
name: Change base branch
if: |
( github.base_ref == 'develop' && ( startsWith(github.head_ref, 'hotfix/') || startsWith(github.head_ref, 'release/') ) )
|| ( github.base_ref == 'main' && ! ( startsWith(github.head_ref, 'hotfix/') || startsWith(github.head_ref, 'release/') || github.head_ref == 'develop' ) )
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- run: |
if ${{ github.base_ref == 'develop' }}; then
gh pr edit --base main
else
gh pr edit --base develop
fi
21 changes: 0 additions & 21 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,6 @@ jobs:
- run: gh --version
- run: docker --version
- run: docker-compose --version
into_main:
if: startsWith(github.head_ref, 'hotfix/') && github.base_ref == 'develop' && ( github.event.action == 'opened' || github.event.action == 'reopened' )
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- run: gh pr edit --base main
into_develop:
if: |
! ( startsWith(github.head_ref, 'hotfix/') || github.head_ref == 'develop' ) && github.base_ref == 'main' && ( github.event.action == 'opened' || github.event.action == 'reopened' )
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- run: gh pr edit --base develop
hotfix:
if: startsWith(github.head_ref, 'hotfix/') && github.base_ref == 'main' && github.event.action == 'closed' && github.event.pull_request.merged
runs-on: ubuntu-latest
Expand Down