Github action for outputting a list of affected nx projects (apps and libs)
The possible inputs for this action are:
inputs:
base:
description: Base of the current branch (usually main)
required: false
head:
description: Latest commit of the current branch (usually HEAD)
required: false
The outputs for this action are:
outputs:
affected:
description: array of affected projects (apps/libs) names
hasAffected:
description: true/false if there are affected projects (apps/libs)
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
id: setSHAs
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'master'
last-successful-event: 'pull_request'
- name: Check for Affected Projects
uses: gang-of-front/action-nx-affected-list@main
id: checkForAffected
with:
base: ${{ steps.setSHAs.outputs.base }}
head: ${{ steps.setSHAs.outputs.head }}
- if: steps.checkForAffected.outputs.hasAffected == 'true'
name: Build (Nx Affected)
uses: mansagroup/nrwl-nx-action@v2
with:
targets: build
affected: true
nxCloud: false
- if: contains(steps.checkForAffected.outputs.affected, 'someAppName')
### do something specific for someAppName
- make new branch and make changes
npm run all
git commit/push changes
- make PR back to main
- wait for pipelines to finish (test will always finish with an error since this isn't a nx monorepo)
git checkout main
git pull
git tag v1
SKIP_HOOKS=true git push origin v1
- in github, edit tag and save (this will push to marketplace)
npm run npm:check
Thanks to ignition-is-go which was the starting point of this code (couldn't find a published version of it)