Skip to content

Commit f72f743

Browse files
mydeaclaude
andauthored
chore(ci): Vendor nx-affected-list action, drop dkhunt27 dependency (#20463)
## Summary Replace the third-party `dkhunt27/action-nx-affected-list@v6.1` with a vendored composite action at `.github/actions/nx-affected-list/`. **Why:** - The external action is outdated (last release Sep 2024) and uses Node.js 20 (GHA deprecation warning) - It's a heavy wrapper (~200 lines of compiled JS) around a single command: `nx show projects --affected` - Third-party CI dependencies are a supply chain risk **What the external action did:** 1. `nx --version` + `nx reset` (prep) 2. `nx show projects --affected --base=X --head=Y` (core logic) 3. Parse output into a list, set as action output **What the vendored action does:** - Runs `nx show projects --affected` directly in bash (~15 lines) - Outputs space-separated project names (compatible with existing `contains()` checks) - No Node.js runtime dependency, no `nx reset` (unnecessary in our setup) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6c2e062 commit f72f743

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: 'Nx Affected List'
2+
description: 'Outputs a space-separated list of Nx projects affected by changes between base and head commits.'
3+
4+
inputs:
5+
base:
6+
description: 'Base commit SHA'
7+
required: false
8+
head:
9+
description: 'Head commit SHA'
10+
required: false
11+
12+
outputs:
13+
affected:
14+
description: 'Space-separated list of affected project names'
15+
value: ${{ steps.affected.outputs.affected }}
16+
17+
runs:
18+
using: 'composite'
19+
steps:
20+
- name: Get affected Nx projects
21+
id: affected
22+
shell: bash
23+
env:
24+
INPUT_BASE: ${{ inputs.base }}
25+
INPUT_HEAD: ${{ inputs.head }}
26+
run: |
27+
set -euo pipefail
28+
extra_args=()
29+
if [ -n "${INPUT_BASE:-}" ]; then extra_args+=(--base="$INPUT_BASE"); fi
30+
if [ -n "${INPUT_HEAD:-}" ]; then extra_args+=(--head="$INPUT_HEAD"); fi
31+
32+
# Fail the step on nx/git errors so empty output cannot skip integration jobs silently.
33+
AFFECTED=$(./node_modules/.bin/nx show projects --affected "${extra_args[@]}" | tr '\n' ' ' | xargs)
34+
echo "affected=$AFFECTED" >> "$GITHUB_OUTPUT"
35+
36+
if [ -n "$AFFECTED" ]; then
37+
echo "Affected projects: $AFFECTED"
38+
else
39+
echo "No affected projects found"
40+
fi

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
id: install_dependencies
101101

102102
- name: Check for Affected Nx Projects
103-
uses: dkhunt27/action-nx-affected-list@v6.1
103+
uses: ./.github/actions/nx-affected-list
104104
id: checkForAffected
105105
if: github.event_name == 'pull_request'
106106
with:

0 commit comments

Comments
 (0)