feat: workflow to auto create PRs to merge main #2
Workflow file for this run
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
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 |