Skip to content

feat: add no-raise option #25

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

Merged
merged 1 commit into from
May 4, 2022
Merged
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
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -64,21 +64,22 @@ jobs:

## Variables

| Name | Description | Default |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
| `github_token` | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}` **required** | - |
| `dry_run` | Run without creating commit, output to stdout | false |
| `repository` | Repository name to push. Default or empty value represents current github repository | current one |
| `branch` | Destination branch to push changes | Same as the one executing the action by default |
| `prerelease` | Set as prerelease {alpha,beta,rc} choose type of prerelease | - |
| `extra_requirements` | Custom requirements, if your project uses a custom rule or plugins, you can specify them separated by a space. E.g: `'commitizen-emoji conventional-JIRA'` | - |
| `changelog_increment_filename` | Filename to store the incremented generated changelog. This is different to changelog as it only contains the changes for the just generated version. Example: `body.md` | - |
| `git_name` | Name used to configure git (for git operations) | `github-actions[bot]` |
| `git_email` | Email address used to configure git (for git operations) | `github-actions[bot]@users.noreply.github.com` |
| `push` | Define if the changes should be pushed to the branch. | true |
| `commit` | Define if the changes should be committed to the branch. | true |
| `commitizen_version` | Specify the version to be used by commitizen. Eg: `2.21.0` | latest |
| `changelog` | Create changelog when bumping the version | true |
| Name | Description | Default |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| `github_token` | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}` **required** | - |
| `dry_run` | Run without creating commit, output to stdout | false |
| `repository` | Repository name to push. Default or empty value represents current github repository | current one |
| `branch` | Destination branch to push changes | Same as the one executing the action by default |
| `prerelease` | Set as prerelease {alpha,beta,rc} choose type of prerelease | - |
| `extra_requirements` | Custom requirements, if your project uses a custom rule or plugins, you can specify them separated by a space. E.g: `'commitizen-emoji conventional-JIRA'` | - |
| `changelog_increment_filename` | Filename to store the incremented generated changelog. This is different to changelog as it only contains the changes for the just generated version. Example: `body.md` | - |
| `git_name` | Name used to configure git (for git operations) | `github-actions[bot]` |
| `git_email` | Email address used to configure git (for git operations) | `github-actions[bot]@users.noreply.github.com` |
| `push` | Define if the changes should be pushed to the branch. | true |
| `commit` | Define if the changes should be committed to the branch. | true |
| `commitizen_version` | Specify the version to be used by commitizen. Eg: `2.21.0` | latest |
| `changelog` | Create changelog when bumping the version | true |
| `no_raise` | Don't raise the given comma-delimited exit codes (e.g., no_raise: '20,21'). Use with caution! Open an issue in [commitizen](https://github.com/commitizen-tools/commitizen/issues) if you need help thinking about your workflow. | [21](https://commitizen-tools.github.io/commitizen/exit_codes/) |

## Outputs

6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -57,4 +57,8 @@ inputs:
commitizen_version:
description: 'Specify the version to be used by commitizen'
required: false
default: 'latest'
default: latest
no_raise:
description: "Don't raise the given comma-delimited exit codes"
required: false
default: '21'
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ if [ $INPUT_CHANGELOG ]; then INPUT_CHANGELOG='--changelog'; else INPUT_CHANGELO
if [ $INPUT_PRERELEASE ]; then INPUT_PRERELEASE="--prerelease $INPUT_PRERELEASE"; else INPUT_PRERELEASE=''; fi
if [ "$INPUT_COMMIT" == 'false' ]; then INPUT_COMMIT='--files-only'; else INPUT_COMMIT=''; fi
if [ "$INPUT_COMMITIZEN_VERSION" == 'latest' ]; then INPUT_COMMITIZEN_VERSION="commitizen"; else INPUT_COMMITIZEN_VERSION="commitizen==$INPUT_COMMITIZEN_VERSION"; fi

if [ -n "$INPUT_NO_RAISE" ]; then INPUT_NO_RAISE="--no-raise $INPUT_NO_RAISE"; else INPUT_NO_RAISE=''; fi

CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
INPUT_BRANCH=${INPUT_BRANCH:-$CURRENT_BRANCH}
@@ -37,9 +37,9 @@ echo "Git email: $(git config --get user.email)"
echo "Running cz: $INPUT_DRY_RUN $INPUT_COMMIT $INPUT_CHANGELOG $INPUT_PRERELEASE"

if [ $INPUT_CHANGELOG_INCREMENT_FILENAME ]; then
cz bump --yes --changelog-to-stdout $INPUT_COMMIT $INPUT_DRY_RUN $INPUT_CHANGELOG $INPUT_PRERELEASE >$INPUT_CHANGELOG_INCREMENT_FILENAME
cz $INPUT_NO_RAISE bump --yes --changelog-to-stdout $INPUT_COMMIT $INPUT_DRY_RUN $INPUT_CHANGELOG $INPUT_PRERELEASE >$INPUT_CHANGELOG_INCREMENT_FILENAME
else
cz bump --yes $INPUT_DRY_RUN $INPUT_COMMIT $INPUT_CHANGELOG $INPUT_PRERELEASE
cz $INPUT_NO_RAISE bump --yes $INPUT_DRY_RUN $INPUT_COMMIT $INPUT_CHANGELOG $INPUT_PRERELEASE
fi

REV=$(cz version --project)