mirror of
https://code.forgejo.org/actions/setup-python
synced 2025-06-10 05:12:19 +02:00
Initial pass
This commit is contained in:
commit
39c08a0eaa
7242 changed files with 1886006 additions and 0 deletions
49
node_modules/run-node/run-node
generated
vendored
Normal file
49
node_modules/run-node/run-node
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env bash
|
||||
# MIT License © Sindre Sorhus
|
||||
|
||||
if [[ -z $RUN_NODE_CACHE_PATH ]]; then
|
||||
PATH_CACHE="$HOME"/.node_path
|
||||
else
|
||||
PATH_CACHE="$RUN_NODE_CACHE_PATH"
|
||||
fi
|
||||
|
||||
get_user_path() {
|
||||
[[ -x "/usr/libexec/path_helper" ]] && eval $(/usr/libexec/path_helper -s)
|
||||
echo "$($SHELL -i -l -c 'echo -e "\n"PATH=\"$PATH:\$PATH\""\n"' 2>/dev/null | grep "^PATH=")" > "$PATH_CACHE"
|
||||
}
|
||||
|
||||
set_path() {
|
||||
if [[ -f "$PATH_CACHE" ]]; then
|
||||
. "$PATH_CACHE"
|
||||
else
|
||||
get_user_path
|
||||
. "$PATH_CACHE"
|
||||
fi
|
||||
|
||||
export PATH
|
||||
}
|
||||
|
||||
has_node() {
|
||||
command -v node >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Check if we have node, otherwise inherit path from user shell
|
||||
if ! has_node; then
|
||||
set_path
|
||||
|
||||
# Retry by deleting old path cache
|
||||
if ! has_node; then
|
||||
rm "$PATH_CACHE"
|
||||
set_path
|
||||
fi
|
||||
fi
|
||||
|
||||
if has_node; then
|
||||
node "$@"
|
||||
else
|
||||
if [[ -z $RUN_NODE_ERROR_MSG ]]; then
|
||||
echo "Couldn't find the Node.js binary. Ensure you have Node.js installed. Open an issue on https://github.com/sindresorhus/run-node"
|
||||
else
|
||||
echo "$RUN_NODE_ERROR_MSG"
|
||||
fi
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue