Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to pass --ignore-merge-commits to cog check call #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | `[email protected]`|
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -70,4 +74,5 @@ runs:
${{ inputs.release }} \
${{ inputs.git-user }} \
${{ inputs.git-user-email }} \
${{ inputs.verify }}
${{ inputs.verify }} \
${{ inputs.ignore-merge-commits }}
9 changes: 7 additions & 2 deletions cog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RELEASE="${3}"
GIT_USER="${4}"
GIT_USER_EMAIL="${5}"
VERIFY="${6}"
IGNORE_MERGE_COMMITs="${7}"

echo "Setting git user : ${GIT_USER}"
git config --global user.name "${GIT_USER}"
Expand All @@ -18,18 +19,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
Expand Down