Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Only use git diff #7

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,11 @@ runs:
echo "Running yarn build"
yarn run build
echo "Running git diff"
GIT_DIFF_FILES=$(git diff-files --ignore-all-space --relative=client)
GIT_DIFF=$(git diff --name-status --relative=client)
if [[ $GIT_DIFF_FILES != "" ]]; then
echo "git diff files:"
echo $GIT_DIFF_FILES
fi
git add .
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why run the git add command? git diff will reveal changes that are not staged, git diff --cached will show diffs for those that are...

but if you're running both git diff and git diff --cached then what's the need to stage any changes?

Copy link
Member Author

@emteknetnz emteknetnz Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case there were any dist files that for whatever reason were previously deleted and committed. When rebuilding the dist files we need to git add them for them to show, otherwise they're untracked.

Probably don't need both git diff and git diff --cached though, but it's harmless

GIT_DIFF=$(git diff --name-status --relative=client && git diff --cached --name-status --relative=client)
if [[ $GIT_DIFF != "" ]]; then
echo "git diff:"
echo $GIT_DIFF
fi
if [[ $GIT_DIFF_FILES != "" ]] || [[ $GIT_DIFF != "" ]]; then
exit 1
fi
fi
Expand Down