Skip to content

Commit db73856

Browse files
committed
better security
1 parent 2e7f160 commit db73856

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/actions/nx-affected-list/action.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ runs:
2020
- name: Get affected Nx projects
2121
id: affected
2222
shell: bash
23+
env:
24+
INPUT_BASE: ${{ inputs.base }}
25+
INPUT_HEAD: ${{ inputs.head }}
2326
run: |
2427
set -euo pipefail
25-
ARGS=""
26-
if [ -n "${{ inputs.base }}" ]; then ARGS="$ARGS --base=${{ inputs.base }}"; fi
27-
if [ -n "${{ inputs.head }}" ]; then ARGS="$ARGS --head=${{ inputs.head }}"; fi
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
2831
2932
# Fail the step on nx/git errors so empty output cannot skip integration jobs silently.
30-
AFFECTED=$(./node_modules/.bin/nx show projects --affected $ARGS | tr '\n' ' ' | xargs)
33+
AFFECTED=$(./node_modules/.bin/nx show projects --affected "${extra_args[@]}" | tr '\n' ' ' | xargs)
3134
echo "affected=$AFFECTED" >> "$GITHUB_OUTPUT"
3235
3336
if [ -n "$AFFECTED" ]; then

0 commit comments

Comments
 (0)