Merge pull request #59 from privilegedescalation/fix/pnpm-detection-use-python3
fix(ci): use python3 for packageManager detection (node not on PATH before setup-node)
This commit is contained in:
@@ -26,7 +26,9 @@ jobs:
|
||||
# Check for packageManager field in package.json (Corepack pinning).
|
||||
# pnpm/action-setup@v4 errors when `packageManager` is set (even without
|
||||
# a `version` input), so we use Corepack directly for those repos.
|
||||
PM=$(node -e "try{const p=require('./package.json');const v=p.packageManager||'';console.log(v.startsWith('pnpm@')?'true':'false')}catch(e){console.log('false')}" 2>/dev/null || echo "false")
|
||||
# Use python3 (pre-installed on Ubuntu ARC runners) instead of node,
|
||||
# because node is not on PATH before the Setup Node step runs.
|
||||
PM=$(python3 -c "import json,sys; d=json.load(open('package.json')); print('true' if d.get('packageManager','').startswith('pnpm@') else 'false')" 2>/dev/null || echo "false")
|
||||
echo "has_package_manager=$PM" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "manager=npm" >> $GITHUB_OUTPUT
|
||||
|
||||
Reference in New Issue
Block a user