Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/actions/nx-affected-list/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Nx Affected List'
description: 'Outputs a space-separated list of Nx projects affected by changes between base and head commits.'

inputs:
base:
description: 'Base commit SHA'
required: false
head:
description: 'Head commit SHA'
required: false

outputs:
affected:
description: 'Space-separated list of affected project names'
value: ${{ steps.affected.outputs.affected }}

runs:
using: 'composite'
steps:
- name: Get affected Nx projects
id: affected
shell: bash
env:
INPUT_BASE: ${{ inputs.base }}
INPUT_HEAD: ${{ inputs.head }}
run: |
set -euo pipefail
extra_args=()
if [ -n "${INPUT_BASE:-}" ]; then extra_args+=(--base="$INPUT_BASE"); fi
if [ -n "${INPUT_HEAD:-}" ]; then extra_args+=(--head="$INPUT_HEAD"); fi

# Fail the step on nx/git errors so empty output cannot skip integration jobs silently.
AFFECTED=$(./node_modules/.bin/nx show projects --affected "${extra_args[@]}" | tr '\n' ' ' | xargs)
echo "affected=$AFFECTED" >> "$GITHUB_OUTPUT"

if [ -n "$AFFECTED" ]; then
echo "Affected projects: $AFFECTED"
else
echo "No affected projects found"
fi
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
id: install_dependencies

- name: Check for Affected Nx Projects
uses: dkhunt27/action-nx-affected-list@v6.1
uses: ./.github/actions/nx-affected-list
id: checkForAffected
if: github.event_name == 'pull_request'
with:
Expand Down
Loading