https://github.com/this-oliver/detect-conventional-bump
detect the bump type for commits
https://github.com/this-oliver/detect-conventional-bump
cicd commits continuous-integration conventional-commits semver
Last synced: 5 months ago
JSON representation
detect the bump type for commits
- Host: GitHub
- URL: https://github.com/this-oliver/detect-conventional-bump
- Owner: this-oliver
- License: mit
- Created: 2025-04-04T14:52:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-14T09:30:15.000Z (about 1 year ago)
- Last Synced: 2025-07-09T13:06:53.609Z (12 months ago)
- Topics: cicd, commits, continuous-integration, conventional-commits, semver
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/detect-conventional-bump
- Size: 632 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# README
[](https://github.com/this-oliver/detect-conventional-bump/actions/workflows/cicd.yaml)
`detect-conventional-bump` is a GitHub Action that uses the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard to determine the type of version bump (`major`, `minor`, `patch`) based on the given [input parameters](#input-parameters). It is designed to be used in CI/CD pipelines to automate versioning and release processes.
The following commit message format is used to determine the bump type ([source](https://github.com/angular/angular/blob/9228a733631a7d3ba79456c7b2da6e6ff239d4cb/contributing-docs/commit-message-guidelines.md#commit-message-header)):
```md
():
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: optional. The scope may be anything specifying the place of the commit change.
│
└─⫸ Commit Type: major|breaking|minor|feat|ft|patch|fix|chore|docs
```
By default, the action uses the following commit types to determine the bump type:
- Major: `major`, `breaking`, `release`
- Minor: `minor`, `feat`, `ft`
- Patch: `patch`, `fix`, `chore`, `docs`
## Usage
```yaml
name: CI/CD
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # needs write permission to push tag and release
steps:
- uses: actions/checkout@v4
- name: Detect bump type
id: bump
uses: this-oliver/detect-conventional-bump@v0.1.3
with:
message: ${{ github.event.head_commit.message }} # 'feat(core): adds new feature'
- name: Bump version and push tag
id: tag
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: ${{ steps.bump.outputs.type }} # bump type should be 'minor'
- name: Create a GitHub release
uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0
with:
tag: ${{ steps.tag.outputs.new_tag }}
name: ${{ steps.tag.outputs.new_tag }}
body: ${{ steps.tag.outputs.changelog }}
```
### Input Parameters
| Parameter | Default | Required | Description |
| --------- | ----------- | ------- | -------- |
| `message` | `""` | Yes | The commit message to check. If not provided, the action will use the latest commit message. |
| `keywords-major` | `major,breaking,release` | No | Comma-separated list of keywords that indicate a major version bump. |
| `keywords-minor` | `minor,feat,ft` | No | Comma-separated list of keywords that indicate a minor version bump. |
| `keywords-patch` | `patch,fix,chore,docs` | No | Comma-separated list of keywords that indicate a patch version bump. |
| `force-scope` | `false` | No | Fails if the message does not contain a scope. |
### Output Parameters
| Parameter | Description |
| --------- | ----------- |
| `type` | The bump type (`major`, `minor`, `patch`) based on the commit message. |