Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: commitizen-tools/commitizen-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.18.2
Choose a base ref
...
head repository: commitizen-tools/commitizen-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 131 additions and 33 deletions.
  1. +1 −1 .cz.toml
  2. +2 −2 .github/workflows/bumpversion.yaml
  3. +19 −0 .github/workflows/update_semver.yml
  4. +35 −0 CHANGELOG.md
  5. +1 −1 Dockerfile
  6. +2 −0 README.md
  7. +46 −26 action.yml
  8. +25 −3 entrypoint.sh
2 changes: 1 addition & 1 deletion .cz.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.commitizen]
name = "cz_conventional_commits"
version = "0.18.2"
version = "0.24.0"
format = "v$version"
update_changelog_on_bump = true
major_version_zero = true
4 changes: 2 additions & 2 deletions .github/workflows/bumpversion.yaml
Original file line number Diff line number Diff line change
@@ -17,12 +17,12 @@ jobs:
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
github_token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
changelog_increment_filename: body.md
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: "body.md"
tag_name: "${{ env.REVISION }}"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
19 changes: 19 additions & 0 deletions .github/workflows/update_semver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Update Major Minor Tags

on:
push:
branches-ignore:
- "**"
tags:
- "*.*.*"
workflow_dispatch:

jobs:
update_major_minor_tags:
name: Make sure major and minor tags are up to date on a patch release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Update semver
uses: haya14busa/action-update-semver@v1
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
## 0.24.0 (2025-02-25)

### Feat

- add support for manual version bumping

## 0.23.1 (2024-12-21)

## 0.23.0 (2024-12-09)

### Feat

- **#55**: add ACTOR input parameter

## 0.22.0 (2024-11-06)

### Feat

- add working-directory input

## 0.21.0 (2024-03-05)

### Feat

- add local version and devrelease as inputs (#69)
- Add PREVIOUS_REVISION to environment

## 0.20.0 (2023-09-14)

### Feat

- Add new option to hide git output

## 0.19.0 (2023-09-08)

## 0.18.2 (2023-05-18)

### Fix
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-alpine
FROM python:3.10-alpine

RUN set -eux; \
apk add --no-cache \
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -67,12 +67,14 @@ jobs:
| Name | Description | Default |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| `github_token` | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}`. Required if `push: true` | - |
| `working_directory` | Change to this directory before running | repo root directory |
| `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_redirect_stderr` | Redirect git output to stderr. Useful if you do not want git output in your changelog | `false` |
| `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 |
72 changes: 46 additions & 26 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
name: 'Bump and changelog using commitizen'
description: 'Create a commit bumping the version of your project and creating a changelog file'
name: "Bump and changelog using commitizen"
description: "Create a commit bumping the version of your project and creating a changelog file"
runs:
using: 'docker'
image: 'Dockerfile'
using: "docker"
image: "Dockerfile"
branding:
icon: 'git-commit'
color: 'purple'
icon: "git-commit"
color: "purple"
outputs:
version:
description: 'New version'
description: "New version"
inputs:
working_directory:
description: "Change to this directory before running"
required: false
dry_run:
description: 'Run without creating commit, output to stdout'
description: "Run without creating commit, output to stdout"
required: false
commit:
description: 'If true a commit is created containing the bump changes'
description: "If true a commit is created containing the bump changes"
required: false
default: "true"
push:
description: 'If true the bump commit is pushed to the remote repository'
description: "If true the bump commit is pushed to the remote repository"
required: false
default: "true"
merge:
@@ -28,51 +31,62 @@ inputs:
required: false
default: "false"
prerelease:
description: 'Set as prerelease version'
description: "Set as prerelease version"
required: false
devrelease:
description: "Non-negative integer for dev. release"
required: false
local_version:
description: "Bump only the local version portion"
required: false
default: "false"
changelog:
description: 'Create changelog when bumping the version'
description: "Create changelog when bumping the version"
default: "true"
required: false
github_token:
description: 'Token for the repo. Can be passed in using $\{{ secrets.GITHUB_TOKEN }}'
required: false
repository:
description: 'Repository name to push. Default or empty value represents current github repository (${GITHUB_REPOSITORY})'
default: ''
description: "Repository name to push. Default or empty value represents current github repository (${GITHUB_REPOSITORY})"
default: ""
required: false
branch:
description: 'Destination branch to push changes'
description: "Destination branch to push changes"
required: false
default: ''
default: ""
extra_requirements:
description: 'Extra commitizen dependencies like your custom plugins or rules'
description: "Extra commitizen dependencies like your custom plugins or rules"
required: false
default: ''
default: ""
changelog_increment_filename:
description: 'Filename to store the incremented generated changelog. This is different to changelog as it only contains the changes for the just generated version'
description: "Filename to store the incremented generated changelog. This is different to changelog as it only contains the changes for the just generated version"
required: false
git_redirect_stderr:
description: "Redirect git output to stderr. Useful if you do not want git output in your changelog"
required: false
default: "false"
git_name:
description: 'Name used to configure git (for git operations)'
description: "Name used to configure git (for git operations)"
required: false
default: 'github-actions[bot]'
default: "github-actions[bot]"
git_email:
description: 'Email address used to configure git (for git operations)'
description: "Email address used to configure git (for git operations)"
required: false
default: 'github-actions[bot]@users.noreply.github.com'
default: "github-actions[bot]@users.noreply.github.com"
commitizen_version:
description: 'Specify the version to be used by commitizen'
description: "Specify the version to be used by commitizen"
required: false
default: latest
no_raise:
description: "Don't raise the given comma-delimited exit codes"
required: false
default: '21'
default: "21"
increment:
description: "Manually specify the desired increment"
required: false
check_consistency:
default: 'false'
default: "false"
description: "check consistency among versions defined in commitizen configuration and version_files"
required: false
gpg_sign:
@@ -86,3 +100,9 @@ inputs:
description: "If true, prints debug output to GitHub Actions stdout."
required: false
default: "false"
actor:
description: "The account that will be used to perform git operations, defaults to the GITHUB_ACTOR"
required: false
manual_version:
description: "Manually specify the version to bump to"
required: false
28 changes: 25 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -34,7 +34,12 @@ echo "${PIP_CMD[@]}"
"${PIP_CMD[@]}"
echo "Commitizen version: $(cz version)"

if [[ $INPUT_WORKING_DIRECTORY ]]; then
cd $INPUT_WORKING_DIRECTORY
fi

PREV_REV="$(cz version --project)"
echo "PREVIOUS_REVISION=${PREV_REV}" >>"$GITHUB_ENV"

CZ_CMD=('cz')
if [[ $INPUT_DEBUG == 'true' ]]; then
@@ -56,15 +61,27 @@ fi
if [[ $INPUT_PRERELEASE ]]; then
CZ_CMD+=('--prerelease' "$INPUT_PRERELEASE")
fi
if [[ $INPUT_DEVRELEASE ]]; then
CZ_CMD+=('--devrelease' "$INPUT_DEVRELEASE")
fi
if [[ $INPUT_LOCAL_VERSION == 'true' ]]; then
CZ_CMD+=('--local-version')
fi
if [[ $INPUT_COMMIT == 'false' ]]; then
CZ_CMD+=('--files-only')
fi
if [[ $INPUT_INCREMENT ]]; then
CZ_CMD+=('--increment' "$INPUT_INCREMENT")
fi
if [[ $INPUT_CHECK_CONSISTENCY ]]; then
if [[ $INPUT_CHECK_CONSISTENCY == 'true' ]]; then
CZ_CMD+=('--check-consistency')
fi
if [[ $INPUT_GIT_REDIRECT_STDERR == 'true' ]]; then
CZ_CMD+=('--git-output-to-stderr')
fi
if [[ $INPUT_MANUAL_VERSION ]]; then
CZ_CMD+=("$INPUT_MANUAL_VERSION")
fi
if [[ $INPUT_CHANGELOG_INCREMENT_FILENAME ]]; then
CZ_CMD+=('--changelog-to-stdout')
echo "${CZ_CMD[@]}" ">$INPUT_CHANGELOG_INCREMENT_FILENAME"
@@ -73,6 +90,11 @@ else
echo "${CZ_CMD[@]}"
"${CZ_CMD[@]}"
fi
if [[ $INPUT_ACTOR ]]; then
ACTOR=$INPUT_ACTOR
else
ACTOR=$GITHUB_ACTOR
fi

REV="$(cz version --project)"
if [[ $REV == "$PREV_REV" ]]; then
@@ -87,15 +109,15 @@ INPUT_BRANCH="${INPUT_BRANCH:-$CURRENT_BRANCH}"
INPUT_REPOSITORY="${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}"

echo "Repository: ${INPUT_REPOSITORY}"
echo "Actor: ${GITHUB_ACTOR}"
echo "Actor: ${ACTOR}"

if [[ $INPUT_PUSH == 'true' ]]; then
if [[ $INPUT_MERGE != 'true' && $GITHUB_EVENT_NAME == 'pull_request' ]]; then
echo "Refusing to push on pull_request event since that would merge the pull request." >&2
echo "You probably want to run on push to your default branch instead." >&2
else
echo "Pushing to branch..."
REMOTE_REPO="https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@${GITHUB_DOMAIN}/${INPUT_REPOSITORY}.git"
REMOTE_REPO="https://${ACTOR}:${INPUT_GITHUB_TOKEN}@${GITHUB_DOMAIN}/${INPUT_REPOSITORY}.git"
git pull "$REMOTE_REPO" "$INPUT_BRANCH"
git push "$REMOTE_REPO" "HEAD:${INPUT_BRANCH}" --tags
fi