Skip to content

Commit

Permalink
Merge pull request #9 from creative-commoners/pulls/1.0/no-client-dir
Browse files Browse the repository at this point in the history
FIX Ensure client directory exists before running git diff
  • Loading branch information
GuySartorelli authored Jul 25, 2022
2 parents a2efb23 + dcf16c3 commit 008fcd7
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,30 @@ runs:
fi
nvm install
nvm use
rm -rf client/dist
if [[ $(npm -v) != $ADMIN_NPM_VERSION ]]; then
npm install -g yarn;
fi
yarn install --network-concurrency 1
if [[ $(cat package.json | jq -r '.scripts.build') != 'null' ]]; then
DIST_DIR=
if [[ -d client/dist ]]; then
DIST_DIR=client/dist
elif [[ -d dist ]]; then
DIST_DIR=dist
else
echo "No dist directory found"
exit 1
fi
echo "Deleting $DIST_DIR"
rm -rf $DIST_DIR
echo "Running yarn build"
yarn run build
echo "Running git diff"
git add client
GIT_DIFF=$(git diff --name-status --relative=client && git diff --cached --name-status --relative=client)
# Add all files to ensure that any new files previously uncommitted are tracked
git add $DIST_DIR
GIT_DIFF=$(git diff --cached --name-status --relative=$DIST_DIR)
if [[ $GIT_DIFF != "" ]]; then
echo "git diff:"
echo "git diff found modified files when it should not have:"
echo $GIT_DIFF
exit 1
fi
Expand Down

0 comments on commit 008fcd7

Please sign in to comment.