Files
fetch-metadata/bin/check-build-output-in-dist-directory
Jeff Widman 06df9f85d6 Check for uncommitted files beyond dist/ directory (#278)
This checks for _any_ delta in the git repo, not just the `dist/`
directory. Any change should fail CI until it's either committed or
added to `.gitignore`.

Additionally, I clarified the script name/code slightly to explain why
it's needed/handled separately from checking for uncommitted files.
2023-07-25 16:18:05 +00:00

15 lines
525 B
Bash
Executable File

#!/bin/bash
# Make sure we notice any untracked files generated by the build in the dist/ directory
git add --intent-to-add .
git diff --quiet dist/
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Detected uncommitted changes after build:"
# The contents of the diff/ folder are marked as generated:
# https://github.com/dependabot/fetch-metadata/blob/6c2bf2fe33cc133b474165107a8b29ccc265dc96/.gitattributes#L1
# so this ensures we spit out the actual change in the obfuscated JS.
git --no-pager diff dist/
exit 1
fi