-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1744 from o1-labs/feat/add-auto-merge-v2
ci: add workflow to automatically merge main into v2 branch
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 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 |
---|---|---|
@@ -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 |