name : appropriate_branch
on :
workflow_call :
inputs :
src_branch :
required : true
type : string
dst_branch :
required : true
type : string
secrets :
PRIVATE_GITHUB_BOT_TOKEN :
description : 'Github bot token'
required : true
env :
CARGO_TERM_COLOR : always
concurrency :
group : appropraite_branch_${{ inputs.src_branch }}_${{ inputs.dst_branch }}
cancel-in-progress : true
jobs :
check :
runs-on : ubuntu-latest
outputs :
shouldSkip : ${{ steps.validation.outputs.wrong-target }}
steps :
- name : Check branch
id : validation
uses : Vankka/pr-target-branch-action@v2.1
env :
GITHUB_TOKEN : ${{ secrets.PRIVATE_GITHUB_BOT_TOKEN }}
with :
target : ${{ inputs.dst_branch }}
exclude : ${{ inputs.src_branch }}
comment : |
To maintain stability of the module the repository uses 3-stages system to forward changes from an unstable branch to a stable.
The unstable branch is `alpha`. All user pull requests should be opened to this branch.
The staging branch is `beta`. Changes to this branch are forwarded by a pull request from branch `alpha` automatically.
The stable branch is `master`. Changes to this branch are forwarded by a pull request from branch `beta` automatically.
The pull request was automatically converted to draft.
Please, change base branch taking into account the described system `alpha -> beta -> master`.
- name : Convert to draft
if : ${{ steps.validation.outputs.wrong-target == 'true' }}
uses: voiceflow/draft-pr@latest
with:
token: ${{ secrets.PRIVATE_GITHUB_BOT_TOKEN }}
- name : Failure
if : ${{ steps.validation.outputs.wrong-target == 'true' }}
run : exit 1