Skip to content

Commit

Permalink
ci: add automatic rebase of v2 on main after push to main
Browse files Browse the repository at this point in the history
  • Loading branch information
egil committed Apr 12, 2024
1 parent 60699a3 commit cbe0cbd
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/rebase-v2-on-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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

0 comments on commit cbe0cbd

Please sign in to comment.