Skip to content

feat: workflow to auto create PRs to merge main #2

feat: workflow to auto create PRs to merge main

feat: workflow to auto create PRs to merge main #2

name: Merge Main to Other Branches
on:
push:
branches:
- main
# just for testing
pull_request:
branches:
- main
jobs:
create-merge-prs:
runs-on: ubuntu-latest
strategy:
matrix:
name: [ezeth, injective, nexus]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
# add "git checkout main" just for testing
- name: Create and push merge branch
run: |
git checkout main
git checkout -b main-to-${{ matrix.name }}
git reset --hard origin/main
git push -f origin main-to-${{ matrix.name }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: ${{ matrix.name }}
title: "chore: merge main into ${{ matrix.name }}"
body: "This PR was automatically created to merge changes from `main` into `${{ matrix.name }}`."
branch: main-to-${{ matrix.name }}
draft: true