ci: add automatic rebase of v2 on main after push to main #1
This file contains hidden or 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
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
VSTEST_CONNECTION_TIMEOUT: 180 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 | |
TERM: xterm | |
jobs: | |
rebase: | |
name: 🎁 Rebase V2 on Main | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛒 Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.BUNIT_BOT_TOKEN }} | |
- name: ⚙️ Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.BUNIT_BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.BUNIT_BOT_GPG_KEY_PASSPHRASE }} | |
- name: ⚙️ Setup CI GIT | |
run: | | |
git config user.name "${{ steps.import_gpg.outputs.name }}" | |
git config user.email ${{ steps.import_gpg.outputs.email }} | |
git config --global user.signingkey ${{ steps.import_gpg.outputs.keyid }} | |
git config --global commit.gpgsign true | |
- name: ⏩ Merge stable with main, push to origin | |
id: rebaseV2 | |
continue-on-error: true | |
run: | | |
git checkout v2 | |
git git rebase origin/main | |
git push origin v2 | |
- name: ⏭ Create pull request from main to v2 when direct rebase fails | |
if: steps.rebaseV2.outcome == 'failure' | |
uses: thomaseizinger/create-pull-request@1.3.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }} | |
with: | |
head: main | |
base: v2 | |
title: Rebase v2 on main |