Skip to content

Commit

Permalink
Add --ff-only option
Browse files Browse the repository at this point in the history
  • Loading branch information
drdanz committed Sep 24, 2019
1 parent c26c0aa commit 92b7d5d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 92b7d5d

Please sign in to comment.