Please use https://github.com/cyberark/enforce-rebase instead.
This action enforces clean, "single-bump" git history that looks like this:
It will fail any pushed PR branches if:
-
A PR branch contains any merge commits.
Specifically, this rule prevents developers from merging master into their branch as a way of making it up-to-date. This creates foxtrot commits and unsightly git log graphs.
This also makes it illegal to update your branch using the Github UI's "Update Branch" button, which cannot be disabled and is a tempting way to merge master into your branch.
-
The branch is not sitting on top of master.
That is, it requires developers to rebase their work on the up-to-date master branch before merging.
Here's an example action.yml
file. Note that you must explicitly include
the actions/checkout@v2
step as well as the enforce-rebase@v1
step:
name: Enforce Rebasing
on: [push]
jobs:
rebase_job:
runs-on: ubuntu-latest
name: Enforce rebasing
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Is Rebased on master?
uses: jonahx/enforce-rebase@v1
"Require linear history" does not allow the feature branch to merge into master. Thus while it keeps the history clean and rebased, it doesn't give you the "bump" to signify which commits are related as a single feature.
This action, by contrast, makes the related commits clear at glance while still keeping the history clean and rebased.