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 2 commits 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]` |
Expand Down
9 changes: 6 additions & 3 deletions 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 @@ -75,6 +79,5 @@ runs:
${{ inputs.git-user }} \
${{ inputs.git-user-email }} \
${{ inputs.verify }} \
${{ inputs.profile }}


${{ inputs.profile }} \
${{ inputs.ignore-merge-commits }}
9 changes: 7 additions & 2 deletions cog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
Expand Down