Repository navigation
fix: pass action inputs to run steps through env - #508
Conversation
Inputs and pull request fields were expanded with ${{ }} directly inside
the nu scripts, so a value with a quote could change the script. They now
reach each step as environment variables and are read with $env.
The llvm.sh installer still gets no version argument when version is empty.
Cpp-Linter Report
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe action now passes inputs to Nushell scripts through environment variables. The installation, dependency setup, checkout, lint, and auto-commit steps read those values from the environment and default unset inputs to empty strings. ChangesAction input handling
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to
|
2bndy5
left a comment
There was a problem hiding this comment.
BTW, I think this approach (where each input is exported as a INPUT_* env var) is automatic for docker-based actions.
Summary
The nu
run:scripts inaction.ymlexpanded${{ inputs.* }}and${{ github.event.pull_request.* }}directly into the script text. This is the pattern zizmor reports astemplate-injection: a value with a quote in it becomes part of the script. This PR passes those values to each step withenv:and reads them with$env.*instead, which is GitHub's recommended way.env:(INPUT_<NAME>, plusPR_HEAD_SHA/PR_HEAD_REPO), andrunner.os/github.repositoryuse the runner'sRUNNER_OS/GITHUB_REPOSITORY.load-envline that sets any of its variables that are missing to"", so an empty input behaves the same as before on every runner.llvm.shstill gets no version argument whenversionis empty (it then installs its default), same as before.${{ }}left inaction.ymlis the cache step'swith:.Checked locally:
zizmor --offline action.ymlreports no findings (45template-injectionbefore); every step script passesnu --ide-check; theRun cpp-linterstep run with a fakeuvpasses values with quotes and spaces (for example-DX='a b') through as single arguments, and still works when most inputs are unset.Related Issues
None.
Summary by CodeRabbit