Skip to content

fix: scan all dirs when script_dirs has multiple entries - #82

Open
fedemaleh wants to merge 1 commit into
mainfrom
fix/shellcheck-multiple-dirs
Open

fix: scan all dirs when script_dirs has multiple entries#82
fedemaleh wants to merge 1 commit into
mainfrom
fix/shellcheck-multiple-dirs

Conversation

@fedemaleh

Copy link
Copy Markdown
Contributor

Summary

The reusable shellcheck workflow documents script_dirs as "Space-separated dirs/files to scan", but the implementation runs find "$SCRIPT_DIRS" with the variable quoted — so a multi-dir value like entrypoint scripts is treated as a single path (entrypoint scripts), which doesn't exist. find then errors and shellcheck runs with no files:

find: 'entrypoint scripts': No such file or directory
No files specified.
##[error]Process completed with exit code 123.

Any caller passing more than one dir/file hits this. A single-dir value works, which is why it went unnoticed.

Fix

Split the space-separated value into an array and pass each element as a distinct find argument, so the documented contract works while keeping each path quoted:

read -ra dirs <<< "$SCRIPT_DIRS"
find "${dirs[@]}" -type f -print0 | xargs -0 shellcheck --severity="$SEVERITY"

No change to the empty-input branch or to the env:-based input handling (no injection surface added).

Test plan

  • Caller with a single dir (script_dirs: scripts) — still works.
  • Caller with multiple dirs (script_dirs: entrypoint scripts) — now scans both (previously errored with exit 123).
  • Empty script_dirs — unchanged (recursive *.sh).

Context

Found while adding PR checks to nullplatform/application-lifecycle-manager, which passes script_dirs: entrypoint scripts. That repo currently works around this by calling the reusable workflow once per directory; this fix lets callers pass the space-separated list as documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant