Closed andrewfenn closed 1 year ago
This change is in the public domain. Feel free to put under whatever license you wish.
@andrewfenn isn't the purpose of this to actually do fast forward? :) Fast forward is what git does when two branches has not diverged, and just basically moves the pointer forward, without a merge commit.
Shouldn't the configuration be named "allow_fastforward" instead?
Yes maybe not the correct terminology for this feature. It is suppose to prevent auto merging when there are only empty commits such as a merge with no file changes.
I suggest you update the PR to have more correct got terminology. It is called fastforward what you (we) want :)
This doesn't enable fastforwards. I am a little confused over the terminology, but this disables any sort of merging if the branches' files are identical thus not resulting in a commit that is empty of file changes. The point of fastforwards is to move the pointer forward if there is no divergent work to merge together. Thus the reason I chose the name disable_fastforwards, because we're disabling merge-branch from acting upon them and creating an empty commit via the github API.
Hope that makes sense. Feel free to change the option if you'd like. I won't be updating the PR because I can see this repo is inactive with a lot of open PRs not looked into. I think it would be a waste of my time if it's just going to rot in the PR section. I mostly posted this for others to use in case they wanted the same feature.
@andrewfenn ok. What I wanted was to have FF. I stopped using this action and just doing plain github commands instead.
name: Master -> Develop
on:
push:
branches:
- master
jobs:
sync-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Git checkout
with:
token: ${{ secrets.PETER_GH_PERSONAL_TOKEN }}
fetch-depth: 0
- name: Merge master -> develop
run: |
git config user.name "GitHub Actions"
git config user.email "peterlauri@gmail.com"
git checkout develop
git merge -m 'master -> develop' master
git push origin develop
@peterlauri Thanks for writing this up I will test this out. Maybe this will work better for me.
@andrewfenn thanks for the PR y think is a good option, at least have print the message the merge was skipped.
I was experiencing a situation where this github action was polluting my commit log with empty commits because it merges fast forwards with no file changes..
This pull request adds a new feature and option to disable this behavior. You can add the option
disable_fastforwards: true
and have this action skip merging if it finds that no files were changed between the branches.This can happen when you do the following:
The merge-branch action will see the fast forward and run the merge action on the API making it be treated as a new commit which isn't doing anything. This feature will disable that from happening by calling the comparison API and checking if the branches are identical or not.