Sync primary branches #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync primary branches | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch to update' | |
required: true | |
type: choice | |
options: | |
- minor-next | |
- major-next | |
jobs: | |
merge: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- name: Set Git config | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Merge lower branch into target branch | |
id: merge | |
run: | | |
LOWER_BRANCH="" | |
if [ ${{ github.event.inputs.branch }} == "minor-next" ]; then | |
LOWER_BRANCH="stable" | |
else if [ ${{ github.event.inputs.branch }} == "major-next" ]; then | |
LOWER_BRANCH="minor-next" | |
else | |
echo "::error::Invalid branch" | |
exit 1 | |
fi | |
git pull origin "$LOWER_BRANCH" || echo "::error::Merge conflict or error detected" && exit 1 | |
- name: Push changes | |
run: git push origin ${{ github.event.inputs.branch }} |