See screenshots of the action... in action
In case anyone is having issues with the lack of -ff
merge options in GitHub's web UI, this protected GitHub fast-forward commit action with Mergefreeze may help.
This is not an ideal solution, and it will cost your organization an additional $40/month for the Mergefreeze subscription, but it works well. We spent a lot of time figuring it out. Mergefreeze, combined with the action, prevents you from accidentally merging via the default web UI options by blocking them using a branch protection rule. The fast-forward action blocks all commits to your desired branch that don't use the action.
When run by adding a /fast-forward
comment to your PR, the action temporarily suspends the required Mergefreeze branch protection rule, merges the commit to your desired branch through the CLI, and then adds back the branch protection rule. This avoids any mistaken merge/rebase commits to the protected branch, and it works just as fast as merging using the traditional web UI options.
Hope this helps someone!
- Setup a Mergefreeze account at https://www.mergefreeze.com/. You need to be on the proactive plan to setup your web API.
- Generate an Organization access token for Mergefreeze under your organization settings.
- Add your repositories and desired protected braches to your Mergefreeze account, using the "Toggle a branch protection rule" freeze method.
a. Note that this action has support for
demo
,staging
, andproduction
branch protections. You can easily edit these branches by editing the actions. - Create a repo that is accessible organization-wide called fast-forward-action. Add the
fast-forward-action.yml
andcheck-comment-action.yml
files to this repository in the instructed locations (see comments at top of file) Ensure that reusable workflows are enabled and can be accessed (https://docs.github.com/en/actions/using-workflows/reusing-workflows#access-to-reusable-workflows). - Add the
fast-forward.yml
action file to every repo that you want to enable these protections on.
In action
Mergefreeze blocking the merge, even after all other branch protection rules have been met
/fast-forward
comment triggers the merge actionThe branch is merged into your target using
-ff