GitHub action that automatically bumps the version in package.json
of your pull request based on PR labels. The action checks the version on main / master branch and bumps the version accordingly. So the next version will be automatically committed and pushed to your Pull Request.
This action is useful when the version can not be automatically bumped after a merge because the main branch is protected.
- The action will be triggered based on your PR's labels.
- Currently, only these labels are supported:
major
,minor
,patch
. - if current version is
1.0.0
and the label isminor
then version will be bumped to1.1.0
- Currently, only these labels are supported:
- The action will fail if:
- Version was not bumped manually and no labels were provided.
- More than one label were applied. i.e. patch, major.
- When labels change, the action will automatically trigger.
- You can still bump the version manually, but you must not apply any of the semver labels or it will fail.
- GITHUB_TOKEN (required): GitHub access token
- NEXT_VERSION: The newly bumped version
- name: Pull Request Semver Action
uses: fadi-quader-mox/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
It's recommend to use this action with styfle/[email protected]
to cancel previous running actions in order to avoid confliciting actions
name: 'Bump Version'
on:
pull_request_target:
types:
- synchronize
- edited
- ready_for_review
- labeled
- reopened
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: 'actions/checkout@v3'
- name: Pull Request Version Bump
uses: fadi-quader-mox/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}