Skip to content
arrow-up

GitHub Action

package.json has updated

v1.0.4 Latest version

package.json has updated

arrow-up

package.json has updated

Indicates when the package.json version has updated in the most recent commit

Installation

Copy and paste the following snippet into your .yml file.

              

- name: package.json has updated

uses: JiPaix/[email protected]

Learn more about this action in JiPaix/package-json-updated-action

Choose a version

GitHub Action to detect changes in package.json version

This action outputs a variable 'has-updated' indicating that the package.json version was updated in the most recent commit.

Inputs

path

Sets the path to the package.json. Default 'package.json'.

Outputs

has-updated

Whether the package.json version has updated.

current-package-version

The current package.json version

Example usage

jobs:
  run-build-if-needed:
    runs-on: ubuntu-latest
    steps:
    - uses: JiPaix/[email protected]
      id: version-updated
      with:
        path: package.json
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - uses: actions/checkout@v3
      if: steps.version-updated.outputs.has-updated
      with:
        fetch-depth: 1
    - uses: actions/setup-node@v3
      if: steps.version-updated.outputs.has-updated
      with:
        node-version: '16.x'
    - run: npm install
      if: steps.version-updated.outputs.has-updated
    - run: npm run build
      if: steps.version-updated.outputs.has-updated