diff --git a/README.md b/README.md index 2714409..55a4bdf 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,12 @@ The name of the development branch (default `devel`). Allow fast forward merge (default `false`). If not enabled, merges will use `--no-ff`. +### `ff_only` + +Refuse to merge and exit unless the current HEAD is already up to date or the +merge can be resolved as a fast-forward (default `false`). +Used only if `allow_ff=false`. + ### `allow_forks` Allow action to run on forks (default `false`). diff --git a/action.yml b/action.yml index 2637ec8..aba169a 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,10 @@ inputs: description: 'Allow fast forward merge' required: false default: false + ff_only: + description: 'Refuse to perform a non fast forward merge (requires allow_ff=true)' + required: false + default: false allow_forks: description: 'Allow action to run on forks' required: false diff --git a/entrypoint.sh b/entrypoint.sh index ef24fad..05bb39c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,6 +7,7 @@ echo " 'Nightly Merge Action' is using the following input:" echo " - stable_branch = '$INPUT_STABLE_BRANCH'" echo " - development_branch = '$INPUT_DEVELOPMENT_BRANCH'" echo " - allow_ff = $INPUT_ALLOW_FF" +echo " - ff_only = $INPUT_FF_ONLY" echo " - allow_forks = $INPUT_ALLOW_FORKS" echo " - user_name = $INPUT_USER_NAME" echo " - user_email = $INPUT_USER_EMAIL" @@ -18,9 +19,12 @@ if [[ -z "${!INPUT_PUSH_TOKEN}" ]]; then exit 1 fi -NO_FF="--no-ff" +FF_MODE="--no-ff" if $INPUT_ALLOW_FF; then - NO_FF="" + FF_MODE="--ff" + if $INPUT_FF_ONLY; then + FF_MODE="--ff-only" + fi fi if ! $INPUT_ALLOW_FORKS; then @@ -63,7 +67,7 @@ echo set -o xtrace # Do the merge -git merge $NO_FF --no-edit $INPUT_STABLE_BRANCH +git merge $FF_MODE --no-edit $INPUT_STABLE_BRANCH # Push the branch git push origin $INPUT_DEVELOPMENT_BRANCH