Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
info

GitHub Action

Get Changed Packages

v0.0.4

Get Changed Packages

info

Get Changed Packages

Returns changed packages and those listed in your changesets

Installation

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

              

- name: Get Changed Packages

uses: caffco/[email protected]

Learn more about this action in caffco/changed-packages-github-action

Choose a version

Maintainability Test Coverage

Changed Packages

Get information about packages with changes and packages included in your release plan.

About

This action works with the changesets versioning tool to allow you to conditionally run other actions based on whether a package has changed or it's included in a release plan.

Usage

name: Run tests if package changed
on: [push, pull_request]
jobs:
  get-changed-packages:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Get changed packages
        uses: caffco/[email protected]
        with:
          base_branch: main
          repository_path: .

  run-tests:
    runs-on: ubuntu-latest
    steps:
        - name: Run package-a tests
        needs: get-changed-packages
        if: ${{contains(needs.get-changed-packages.outputs.changed_packages, 'package-a')}}
        run: yarn test-package-a

        - name: Run package-b tests
        needs: get-changed-packages
        if: ${{contains(needs.get-changed-packages.outputs.changed_packages, 'package-b')}}
        run: yarn test-package-b