diff --git a/README.md b/README.md index feb65c8..36b1f6d 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ Here are all the inputs available through `with`: |-------------------------|--------------------------------------------------------------------------------------------------|----------------| | `check` | Check conventional commit compliance with `cog check` | `true` | | `check-latest-tag-only` | Check conventional commit compliance with `cog check --from-latest-tag` | `false` | +| `ignore-merge-commits` | Ignore merge commits with `cog check --ignore-merge-commits` | `false` | | `release` | Perform a release using `cog bump --auto` | `false` | | `git-user` | Set the git `user.name` to use for the release commit | `cog-bot` | | `git-user-email` | Set the git `user.email` to use for the release commit | `cog@demo.org` | diff --git a/action.yml b/action.yml index c3c6ddb..a02a245 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,10 @@ inputs: description: Check commit history from latest tag to HEAD required: false default: 'false' + ignore-merge-commits: + description: Ignore merge commits when checking commit history + required: false + default: 'false' git-user: description: Git user.name configuration required: false @@ -75,6 +79,5 @@ runs: ${{ inputs.git-user }} \ ${{ inputs.git-user-email }} \ ${{ inputs.verify }} \ - ${{ inputs.profile }} - - + ${{ inputs.profile }} \ + ${{ inputs.ignore-merge-commits }} diff --git a/cog.sh b/cog.sh index 1da0f23..34bc155 100755 --- a/cog.sh +++ b/cog.sh @@ -9,6 +9,7 @@ GIT_USER="${4}" GIT_USER_EMAIL="${5}" VERIFY="${6}" PROFILE="${7}" +IGNORE_MERGE_COMMITs="${8}" echo "Setting git user : ${GIT_USER}" git config --global user.name "${GIT_USER}" @@ -19,18 +20,22 @@ git config --global user.email "${GIT_USER_EMAIL}" cog --version if [ "${CHECK}" = "true" ]; then + flags="" + if [ "${IGNORE_MERGE_COMMITs}" = "true" ]; then + flags="$flags --ignore-merge-commits" + fi if [ "${LATEST_TAG_ONLY}" = "true" ]; then + flags="$flags --from-latest-tag" if [ "$(git describe --tags --abbrev=0)" ]; then message="Checking commits from $(git describe --tags --abbrev=0)" else message="No tag found checking history from first commit" fi echo "${message}" - cog check --from-latest-tag || exit 1 else echo "Checking all commits" - cog check || exit 1 fi + cog check $flags || exit 1 fi if [ "$RELEASE" = "true" ]; then