Add a Git Diff to the output of the static checks job on failure#24154
Add a Git Diff to the output of the static checks job on failure#24154
Conversation
|
Size Change: -1.03 MB (89%) 🏆 Total Size: 1.16 MB
ℹ️ View Unchanged
|
01aacfc to
5cd7bef
Compare
talldan
left a comment
There was a problem hiding this comment.
Nice idea, this would be really useful. 🎉
Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
| "check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2 --ignore=@react-native-community/cli,@react-native-community/cli-platform-ios\" \"wp-scripts check-licenses --dev\"", | ||
| "precheck-local-changes": "npm run docs:build", | ||
| "check-local-changes": "( git diff -U0 | xargs -0 node bin/process-git-diff ) || ( echo \"There are local uncommitted changes after one or both of 'npm install' or 'npm run docs:build'!\" && exit 1 );", | ||
| "check-local-changes": "( git diff -U0 | xargs -0 node bin/process-git-diff ) || ( echo \"There are local uncommitted changes after one or both of 'npm install' or 'npm run docs:build'!\" && git diff --exit-code && exit 1 );", |
There was a problem hiding this comment.
Why --exit-code? From the documentation, I'm not sure how it helps, as we don't look at exit codes (and actually it could short-circuit that last && exit 1.
--exit-code
Make the program exit with codes similar to diff(1). That is, it exits with 1 if there were differences and 0 means no differences.
There was a problem hiding this comment.
When I tested, git diff doesn't exit, it awaits user input.
There was a problem hiding this comment.
Hm, I see. What about git --no-pager diff?
There was a problem hiding this comment.
Did not know about that option, that looks like it'd be better, yep 👍
This allows to understand why it's failing more quickly.