Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,27 @@ runs:
path: ${{ inputs.working-directory }}/${{ inputs.venv-dir }}
key: setup-venv-${{ runner.os }}-py-${{ steps.setup-python.outputs.python-version }}-${{ steps.setup-python.outputs.python-path }}-${{ hashFiles(inputs.cache-dependency-path) }}-${{ inputs.install-cmd }}

- run: python -m venv ${{ inputs.venv-dir }}
- run: python -m venv "$VENV_DIR"
if: steps.cache-venv.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
VENV_DIR: ${{ inputs.venv-dir }}

- run: |
SCRIPT_DIR="${{ runner.os == 'Windows' && 'Scripts' || 'bin' }}"
source ${{ inputs.venv-dir }}/${SCRIPT_DIR}/activate
SCRIPT_DIR="${RUNNER_OS_VENV_SCRIPT_DIR}"
source "$VENV_DIR"/${SCRIPT_DIR}/activate
echo "VIRTUAL_ENV=${VIRTUAL_ENV}" >> $GITHUB_ENV
echo "${VIRTUAL_ENV}/${SCRIPT_DIR}" >> $GITHUB_PATH
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
RUNNER_OS_VENV_SCRIPT_DIR: ${{ runner.os == 'Windows' && 'Scripts' || 'bin' }}
VENV_DIR: ${{ inputs.venv-dir }}

- run: ${{ inputs.install-cmd }}
- run: "$INSTALL_CMD"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quoted command variable prevents shell word splitting

High Severity

Wrapping $INSTALL_CMD in double quotes ("$INSTALL_CMD") causes bash to treat the entire expanded value as a single token (the command name), suppressing word splitting. For typical values like pip install -r requirements.txt, bash will look for a binary literally named pip install -r requirements.txt instead of running pip with arguments install, -r, requirements.txt. This breaks the action for essentially all users who supply an install-cmd.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 965c885. Configure here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Quoting $INSTALL_CMD in the run step prevents word splitting, causing multi-word install commands to fail with a "No such file or directory" error.
Severity: CRITICAL

Suggested Fix

Remove the double quotes around $INSTALL_CMD in the run step. Change run: "$INSTALL_CMD" to run: $INSTALL_CMD to allow the shell to correctly parse the command and its arguments through word splitting.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: action.yml#L59

Potential issue: The `install-cmd` input is executed within double quotes as
`"$INSTALL_CMD"`. This prevents the shell from performing word splitting. As a result,
any command with arguments, such as `pip install -r requirements.txt`, will be treated
as a single command name. The shell will attempt to find and execute a file literally
named `pip install -r requirements.txt`, which will fail with a "No such file or
directory" error. This breaks the intended functionality for nearly all common use cases
of the `install-cmd` input.

Did we get this right? 👍 / 👎 to inform future reviews.

if: inputs.install-cmd != '' && steps.cache-venv.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
INSTALL_CMD: ${{ inputs.install-cmd }}
Loading