Skip to content

bbonkr/next-version-proposal-action

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

Next version proposal action

View on Marketplace: next-version-proposal-action

Github action which recommends a name for the next version based on your git tag and pull request labels.

Usages

Inputs

Name Required Description
github_token GitHub Personal Access Token. It requires REPO scope. Defaluts to github.token
pr Pull request number. Input just number e.g. 100. Defaults to github.event.pull_request.number
major_labels A comma-separated list of label names to increment the major version by. Defaults to major,next
minor_labels A comma-separated list of label names to increment the minor version by. Defaults to enhancement,feature
patch_labels A comma-separated list of label names to increment the patch version by.
next_version_prefix Next version prefix
logging Shows log messages. (You want to show log message please set true.)

Note

We no longer maintain patch labels. If it cannot find a matching label in the major and minor labels, it treats as a patch version increase.

Outputs

Name Description
latest_version Latest version of git tag
next_version Recommended next version name
next_version_major Major version of Recommended next version
next_version_minor Minor version of Recommended next version
next_version_patch Patch version of Recommended next version
  • next_version is 1.0.0 if latest version could not find.
  • latest_version is latest git tag name of git tags SEMVER1 formatted.

Example

TL;DR

      - name: Get next version
        uses: bbonkr/next-version-proposal-action@v1
        id: next_version_proposal

      - name: Use
        run: echo "next_version=${{ steps.next_version_proposal.outputs.next_version }}"

Full

We recommend using this action in the pull_request event, because this action requires PR ref.

You can recognize the PR is closed as completed with condition of github.event.pull_request.merged == true.

name: 'create-tag'

on:
  pull_request:
    branches:
      - main
    types:
      - closed

jobs:
  next_version:
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged == true # It represents PR is closed as completed
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Get next version
        uses: bbonkr/next-version-proposal-action@v1
        id: next_version_proposal
        with:
          github_token: ${{ github.token }}
          pr: ${{ github.event.pull_request.number }}
          major_labels: 'major,next'
          minor_labels: 'enhancement,feature'
          next_version_prefix: 'v'

      - name: logging
        run: |
          echo "latest_version=${{ steps.next_version_proposal.outputs.latest_version }}"
          echo "next_version=${{ steps.next_version_proposal.outputs.next_version }}"
          echo "next_version_major=${{ steps.next_version_proposal.outputs.next_version_major }}"
          echo "next_version_minor=${{ steps.next_version_proposal.outputs.next_version_minor }}"
          echo "next_version_patch=${{ steps.next_version_proposal.outputs.next_version_patch }}"

References

Footnotes

  1. https://semver.org/

About

Github action which recommends a name for the next version based on your git tag and pull request labels

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •