Skip to content
play

GitHub Action

Cambios (pnpm)

v1.0.1 Latest version

Cambios (pnpm)

play

Cambios (pnpm)

Github action to detect if there are any changes in repository using pnpm since some point in your git history

Installation

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

              

- name: Cambios (pnpm)

uses: akshay5995/[email protected]

Learn more about this action in akshay5995/cambios

Choose a version

cambios

Github action to detect if there are any changes in pnpm workspace or repository using pnpm since some point (git ref, git tag or commit-sha) in your git history

Internally uses pnpm's filtering capabilities

Usage

 ....
    steps:
     # setup your node and pnpm
     ....
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Get changed packages
        uses: akshay5995/[email protected]
        id: changed-package-action
        with:
          package-name: "" # Optional
          since: "" # Optional defaults to "origin/main"
      - name: echo changed packages
        run: echo ${{ steps.changed-package-action.outputs.changed-packages }}
      - name: echo CHANGE_DETECTED env
        run: echo ${{ env.CHANGE_DETECTED }}

Inputs

Name in your package.json for the package that you want to detect change for:

    package-name: "" # Optional
    since: "" # Optional defaults to "origin/main"

Outputs

Environment variable:

    CHANGE_DETECTED

Can be used in following steps:

    steps:
      ....
      - name: Get changed packages
        uses: akshay5995/[email protected]
      - name: Run tests if only package has changed
        if: ${{ env.CHANGE_DETECTED }}
        run: pnpm test:ci

Output:

  changed-packages 

Can be used in following steps: (useful in a monorepo that uses pnpm workspaces)

    steps:
      ....
      - name: Get changed packages
        uses: akshay5995/[email protected]
        id: changed-package-action
      - name: Echo all changed packages in the repo
        run: echo ${{ steps.changed-package-action.outputs.changed-packages }}

Outputs stringified Json array for changed packages e.g, "["cambios"]"