Skip to content

Commit 2bae08e

Browse files
author
Hendry, Adam
committed
feat(debug): add option for debug output
1 parent fa64f0e commit 2bae08e

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,7 @@ inputs:
8787
The GPG private key to sign commits and tags (for git operations). `gpg_sign` must
8888
be set to true.
8989
required: false
90-
defaul: ''
90+
debug:
91+
description: "If true, prints debug output to GitHub Actions stdout."
92+
required: false
93+
default: "false"

entrypoint.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ git config --local pull.rebase true
1414
echo "Git name: $(git config --get user.name)"
1515
echo "Git email: $(git config --get user.email)"
1616

17+
if [[ $INPUT_GPG_SIGN == 'true' ]]; then
18+
if [[ -z $INPUT_GPG_PRIVATE_KEY ]]; then
19+
echo 'Missing input "gpg_private_key".' >&2
20+
exit 2
21+
fi
22+
echo "Configuring GPG for signing commits and tags..."
23+
git config --local commit.gpgsign true
24+
git config --local tag.gpgsign true
25+
git config --local user.signingkey "${INPUT_GPG_PRIVATE_KEY}"
26+
echo "Git sign commits?: $(git config --get commit.gpgsign)"
27+
echo "Git sign tags?: $(git config --get tag.gpgsign)"
28+
fi
29+
1730
PIP_CMD=('pip' 'install')
1831
if [[ $INPUT_COMMITIZEN_VERSION == 'latest' ]]; then
1932
PIP_CMD+=('commitizen')
@@ -29,19 +42,14 @@ echo "Commitizen version: $(cz version)"
2942
PREV_REV="$(cz version --project)"
3043

3144
CZ_CMD=('cz')
45+
if [[ $INPUT_DEBUG == 'true' ]]; then
46+
CZ_CMD+=('--debug')
47+
fi
3248
if [[ $INPUT_NO_RAISE ]]; then
3349
CZ_CMD+=('--no-raise' "$INPUT_NO_RAISE")
3450
fi
3551
CZ_CMD+=('bump' '--yes')
3652
if [[ $INPUT_GPG_SIGN == 'true' ]]; then
37-
if [[ -z $INPUT_GPG_PRIVATE_KEY ]]; then
38-
echo 'Missing input "gpg_private_key".' >&2
39-
exit 2
40-
fi
41-
git config --local gpg.program gpg
42-
git config --local commit.gpgsign true
43-
git config --local tag.gpgsign true
44-
git config --local user.signingkey "${INPUT_GPG_PRIVATE_KEY}"
4553
CZ_CMD+=('--gpg-sign')
4654
fi
4755
if [[ $INPUT_DRY_RUN == 'true' ]]; then

0 commit comments

Comments
 (0)