Skip to content

Making it simple to automatically bump versions of JavaScript projects based on Pull Request name, using GitHub Actions

License

Notifications You must be signed in to change notification settings

robhowell/pull-request-version-check-action

Repository files navigation

Pull Request Version Check

Making it simple to automatically bump versions of JavaScript projects based on Pull Request name, using GitHub Actions.

This is a Github Action that ensures that your PR title starts with patch:, minor: or major:.

This is helpful when you're using semantic-release, to support the three prefixes above. When using the "Squash and merge" strategy, Github will suggest to use the PR title as the commit message. With this action you can validate that the PR title will lead to a correct commit message.

How to setup this action

If you haven't used GitHub Actions before, create a file named pull-request-version-check.yml at the following path:

  • .github/workflows/pull-request-version-check.yml

Add the following contents to the file:

name: 'Pull Request Version Check'
on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize

jobs:
  version-check:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Pull Request Version Check
        uses: robhowell/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

How to configure Semantic Release on your mainline branch

Install semantic-release and plugins as devDependencies in your project:

  • npm --save-dev semantic-release @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/git @semantic-release/release-notes-generator
  • Create release.yml file based on the release.yml file in this repo

Examples for valid PR titles

  • patch: Correct typo.
  • minor: Add support for Node 12.
  • major: Drop support for Node 8.

Prior art

About

Making it simple to automatically bump versions of JavaScript projects based on Pull Request name, using GitHub Actions

Resources

License

Stars

Watchers

Forks

Packages

No packages published