A Github Action which automatically creates PR from one branch (configurable with env variable HEAD_BRANCH) against another branch (configurable with env variable as BASE_BRANCH) if it (HEAD_BRANCH) is ahead of another branch (BASE_BRANCH)
Code owner's / reviewers can then merge this PR with usual flow.
This action can be used to keep any two branches in sync. For example, if you have development branch (let's say master or main) and release branch (let's say release) then any hotfixes pushed to release branch should also be merged to development branch. This plugin automatically creates PR from specified HEAD_BRANCH against BASE_BRANCH if HEAD_BRANCH is ahead of BASE_BRANCH.
Following example show usage of action to create PR from release (HEAD_BRANCH) against main (BASE_BRANCH)
name: Create PR
on: [push]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create PR
uses: medlypharmcy/create-pr-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- GITHUB_TOKEN (required) - Required for permission to create PR.
- HEAD_BRANCH(optional) - Branch to create PR from (default: release)
- BASE_BRANCH(optional) - Branch to raise PR against (default: main)
Following example shows usage of create pr action which will create PR from development branch against master.
name: build_and_upload
on: [push]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11.0.8
uses: actions/setup-java@v1
with:
java-version: 11.0.8
- name: Build
run: echo "building project"
- name: Create PR
uses: tango340b/create-pr-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_BRANCH: development
BASE_BRANCH: master- Add this action to your repo.
- Push changes to HEAD_BRANCH (ex: hotfixes to release branch)
- This action creates PR from HEAD_BRANCH against BASE_BRANCH. If PR has zero file changes, then PR is auto closed.
- Integrate slack to notify repository owners about PR.
- Feature for Cross repository PRs.
- Feature to create PRs against multiple branches