Skip to content

Github action that updates a PR base brach from a protected branch to a default branch.

Notifications You must be signed in to change notification settings

a-b-r-o-w-n/check-base-branch-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Check Base Branch

check-base-branch validates that pull requests are opened against allowed branches, failing the check or updating the base branch if not.

Usage

Failing the check

In `.github/workflows/main.yml:

name: Example Workflow

on: [pull_request]

jobs:
  check-base-branch:
    steps:
      - uses: a-b-r-o-w-n/check-base-branch-action@v1.1
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
          protected-branches: "main, production"

Updating the base branch

In `.github/workflows/main.yml:

name: Example Workflow

on: [pull_request]

jobs:
  check-base-branch:
    steps:
      - uses: a-b-r-o-w-n/check-base-branch-action@v1.1
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
          protected-branches: "main, production"
          default-branch: "dev"
          update-branch: true

Inspiration

Some projects set a default branch to something other than their development branch. It is easy for contributors to unknowingly open pull requests against the default branch instead of the development branch. Sometimes this was missed for small changes and resulted in commits getting merged into the protected branch. This action was created to help maintainers catch this problem in an automated way.

About

Github action that updates a PR base brach from a protected branch to a default branch.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •