Skip to content

Commit

Permalink
Merge pull request #1744 from o1-labs/feat/add-auto-merge-v2
Browse files Browse the repository at this point in the history
ci: add workflow to automatically merge main into v2 branch
  • Loading branch information
MartinMinkov authored Jul 12, 2024
2 parents 744c009 + 15fe7d6 commit 64ef49f
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/auto-merge-main-to-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Purpose:
# This workflow automatically attempts to merge changes from the 'main' branch into the 'v2' branch
# whenever changes are pushed to 'main'. If the automatic merge fails due to conflicts, it creates
# a pull request for manual resolution.
#
# Workflow Details:
# 1. Triggered on every push to the 'main' branch.
# 2. Checks out the repository with full history.
# 3. Configures Git with GitHub Actions bot credentials.
# 4. Attempts to merge 'main' into 'v2' and push the result.
# 5. If merge fails, creates a pull request for manual conflict resolution.

name: Auto-merge main to v2

on:
push:
branches:
- main

jobs:
auto-merge:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Configure Git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Try to merge main into v2
run: |
git checkout v2
git merge origin/main
git push origin v2
continue-on-error: true

- name: Create Pull Request if merge failed
if: failure()
uses: peter-evans/create-pull-request@v6
with:
branch: auto-merge-main-to-v2-${{ github.sha }}
title: 'Auto-merge main to v2 (commit ${{ github.sha }})'
body: 'This PR was automatically created to merge changes from main into v2. Please resolve conflicts and merge manually.'
base: v2

0 comments on commit 64ef49f

Please sign in to comment.