-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathaction.yml
More file actions
40 lines (35 loc) · 1.21 KB
/
action.yml
File metadata and controls
40 lines (35 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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