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

freshactions/check-base-branch-action

 
 

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/[email protected]
        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/[email protected]
        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

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.7%
  • TypeScript 0.3%