Skip to content

Commit 77fad83

Browse files
delucisHiDeoo
andauthored
Use latest PNPM version if not specified (#81)
Co-authored-by: HiDeoo <[email protected]>
1 parent 063f85a commit 77fad83

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ runs:
3838
elif [ $(find "." -maxdepth 1 -name "pnpm-lock.yaml") ]; then
3939
echo "PACKAGE_MANAGER=pnpm" >> $GITHUB_ENV
4040
echo "LOCKFILE=pnpm-lock.yaml" >> $GITHUB_ENV
41+
# If packageManager field is not present, use latest version.
42+
if ! jq -e '.packageManager' package.json > /dev/null 2>&1; then
43+
VERSION="latest"
44+
# Annotate this action run to let users know we’re using the default.
45+
echo "::warning title=Could not detect PNPM version::No \`packageManager\` field found in \`package.json\`. Using latest PNPM version instead. We recommend specifying \`pnpm@VERSION\` explicitly using the \`packageManager\` field in your \`package.json\`."
46+
fi
4147
elif [ $(find "." -maxdepth 1 -name "yarn.lock") ]; then
4248
echo "PACKAGE_MANAGER=yarn" >> $GITHUB_ENV
4349
echo "LOCKFILE=yarn.lock" >> $GITHUB_ENV

0 commit comments

Comments
 (0)