Skip to content

Commit b0da45a

Browse files
authored
fix(action): install cve-lite-cli via npm and add bin to GITHUB_PATH (#692)
npx on npm 10.x fails to resolve the cve-lite binary from the cve-lite-cli package regardless of syntax. Switch to an explicit npm install --prefix step that adds the bin directory to GITHUB_PATH, making cve-lite available in all subsequent steps without PATH issues.
1 parent cb3ba22 commit b0da45a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

action.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,19 @@ runs:
120120
echo "offline-db=${resolved_offline_db}"
121121
} >> "$GITHUB_OUTPUT"
122122
123+
- name: Install CVE Lite CLI
124+
shell: bash
125+
env:
126+
INPUT_VERSION: ${{ inputs.version }}
127+
run: |
128+
npm install --prefix "$RUNNER_TEMP/cve-lite-install" "cve-lite-cli@${INPUT_VERSION}"
129+
echo "$RUNNER_TEMP/cve-lite-install/node_modules/.bin" >> "$GITHUB_PATH"
130+
123131
- name: Sync local advisory database
124132
if: ${{ inputs.sync-advisories == 'true' }}
125133
shell: bash
126134
working-directory: ${{ github.workspace }}
127135
env:
128-
INPUT_VERSION: ${{ inputs.version }}
129136
OFFLINE_DB_PATH: ${{ steps.resolve.outputs.offline-db }}
130137
INPUT_CA_CERT: ${{ inputs.ca-cert }}
131138
run: |
@@ -135,13 +142,12 @@ runs:
135142
if [[ -n "${INPUT_CA_CERT}" ]]; then
136143
sync_args+=("--ca-cert" "${INPUT_CA_CERT}")
137144
fi
138-
npx --yes --package "cve-lite-cli@${INPUT_VERSION}" cve-lite "${sync_args[@]}"
145+
cve-lite "${sync_args[@]}"
139146
140147
- name: Run CVE Lite CLI scan
141148
shell: bash
142149
working-directory: ${{ github.workspace }}
143150
env:
144-
INPUT_VERSION: ${{ inputs.version }}
145151
PROJECT_PATH: ${{ steps.resolve.outputs.project-path }}
146152
USE_OFFLINE: ${{ steps.resolve.outputs.use-offline }}
147153
OFFLINE_DB_PATH: ${{ steps.resolve.outputs.offline-db }}
@@ -202,4 +208,4 @@ runs:
202208
args+=("--ca-cert" "${INPUT_CA_CERT}")
203209
fi
204210
205-
npx --yes --package "cve-lite-cli@${INPUT_VERSION}" cve-lite "${args[@]}"
211+
cve-lite "${args[@]}"

0 commit comments

Comments
 (0)