Skip to content

fadi-quader-mox/pr-version-bump

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

PR Auto Version Bump

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.

Workflow

  • 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 is minor then version will be bumped to 1.1.0
  • 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.

Options

Inputs

  • GITHUB_TOKEN (required): GitHub access token

Outputs

  • NEXT_VERSION: The newly bumped version

Usage

- 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

Full example

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 }}

About

GitHub Action that bumps npm version in Pull Request based on GitHub label

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •