shiftingtech is merging refs/heads/main into live 🚀 #1
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: Merge main into testing/live | |
run-name: ${{ github.actor }} is merging ${{ github.ref }} into ${{ inputs.targetBranch }} 🚀 | |
on: | |
workflow_dispatch: | |
inputs: | |
targetBranch: | |
description: 'Target Branch' | |
required: true | |
default: 'testing' | |
type: choice | |
options: | |
- testing | |
- live | |
force: | |
description: 'Force sync (hard reset to main)' | |
required: true | |
default: false | |
type: boolean | |
jobs: | |
manual_merge: | |
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Attempt the merge | |
id: merge_one | |
continue-on-error: true | |
run: | | |
git checkout ${{ inputs.targetBranch }} | |
git merge main --ff-only | |
git push | |
- name: Force merge if necessary | |
if: ${{ job.steps.merge_one.status == failure() && github.event.inputs.force == 'true' }} | |
run: | | |
git checkout ${{ inputs.targetBranch }} | |
git reset --hard main | |
git push --force | |
- name: Properly fail if force is false | |
if: ${{ job.steps.merge_one.status == failure() && github.event.inputs.force == 'false' }} | |
run: exit 1 | |
- run: echo "🍏 This job's status is ${{ job.status }}." |