forked from hennikatsoci/eslint-plus-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·40 lines (29 loc) · 953 Bytes
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
echo "ENTRY"
# Removes confusing pushd / popd logging to output
pushd () {
local CPWD;
CPWD="$(pwd)"
command pushd "$@" > /dev/null
echo "[pushd] [${CPWD}] -> [$(pwd)]"
}
popd () {
local CPWD
CPWD="$(pwd)"
command popd "$@" > /dev/null
echo "[popd] [${CPWD}] -> [$(pwd)]"
}
set -e
if [ ! -d "./node_modules" ] || [ "$2" = 'true' ] ; then
echo "Install Yarn"
[ -f yarn.lock ] && yarn install --frozen-lockfile --prefer-offline
[ -f package-lock.json ] && npm ci
fi
pushd /action
echo "Yarn Action Install"
[ -f yarn.lock ] && NODE_ENV=production yarn install --frozen-lockfile --prefer-offline
[ -f package-lock.json ] && NODE_ENV=production npm install
popd
echo "Execute From Directory: $(pwd)"
NODE_PATH=node_modules GITHUB_TOKEN="${GITHUB_TOKEN:-${1:-.}}" SOURCE_ROOT=${2:-.} node /action/lib/run.js
# rm -rf node_modules # cleanup to prevent some weird permission errors later on