-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor branch merge into own reusable workflow
- Loading branch information
Showing
4 changed files
with
66 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,37 +57,20 @@ jobs: | |
|
||
|
||
merge-to-main: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- verify-latest-release | ||
- verify-repo-secrets | ||
- verify-repo-vars | ||
|
||
steps: | ||
- name: ⬇️ Checkout ${{ vars.MAIN_BRANCH }} | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ vars.MAIN_BRANCH }} | ||
fetch-depth: 0 | ||
|
||
- name: 🔑 Set Bot Authentication | ||
run: | | ||
git config --global user.name "${{ env.GH_USER }}" | ||
git config --global user.email "${{ env.GH_EMAIL }}" | ||
- name: 🔀 Merge ${{ github.ref_name }} -> ${{ vars.MAIN_BRANCH }} | ||
run: | | ||
git pull origin ${{ github.ref_name }} | ||
git merge --no-ff origin/${{ github.ref_name }} -m "[Automated] Merged ${{ github.ref_name }} -> ${{ vars.MAIN_BRANCH }}" | ||
# TODO implement this using gh command | ||
- name: 🔏 Push to protected main branch | ||
uses: CasperWA/[email protected] | ||
with: | ||
token: ${{ env.GH_TOKEN }} | ||
branch: ${{ vars.MAIN_BRANCH }} | ||
tags: false | ||
unprotect_reviews: false | ||
uses: ynput/ops-repo-automation/.github/workflows/merge_branch.yml@refactor-release-workflow-structure | ||
with: | ||
repo: ${{ github.repository }} | ||
checkout_branch: ${{ vars.MAIN_BRANCH }} | ||
merge_from_branch: ${{ github.ref_name }} | ||
secrets: | ||
gh_token: ${{ secrets.token }} | ||
gh_user: ${{ secrets.user }} | ||
gh_email: ${{ secrets.email }} | ||
|
||
|
||
build-from-main: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: merge branch | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
repo: | ||
type: string | ||
required: true | ||
checkout_branch: | ||
type: string | ||
required: true | ||
merge_from_branch: | ||
type: string | ||
required: true | ||
secrets: | ||
gh_token: | ||
required: true | ||
gh_user: | ||
required: true | ||
gh_email: | ||
required: true | ||
|
||
env: | ||
GH_TOKEN: ${{ secrets.gh_token }} | ||
|
||
jobs: | ||
merge-to-main: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: ⬇️ Checkout ${{ inputs.checkout_branch }} | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.checkout_branch }} | ||
fetch-depth: 0 | ||
|
||
- name: 🔑 Set Bot Authentication | ||
run: | | ||
git config --global user.name "${{ secrets.gh_user }}" | ||
git config --global user.email "${{ secrets.gh_email }}" | ||
- name: 🔀 Merge ${{ inputs.merge_from_branch }} -> ${{ inputs.checkout_branch }} | ||
run: | | ||
git pull origin ${{ inputs.merge_from_branch }} | ||
git merge --no-ff origin/${{ inputs.merge_from_branch }} -m "[Automated] Merged ${{ inputs.merge_from_branch }} -> ${{ inputs.checkout_branch }}" | ||
# TODO implement this using gh command | ||
- name: 🔏 Push to protected ${{ inputs.checkout_branch }} branch | ||
uses: CasperWA/[email protected] | ||
with: | ||
token: ${{ secrets.gh_token }} | ||
branch: ${{ inputs.checkout_branch }} | ||
tags: false | ||
unprotect_reviews: false |
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
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