Skip to content

Commit

Permalink
Add a make pre-push target
Browse files Browse the repository at this point in the history
pre-push ensures that all generated content, copywrites and lints are
run and ends with an error if a mutation is caused.

usage:
  1. with all your work added and committed (or stashed)
  2. run `make pre-push && git push`
  3. if any mutations occur, you can amend/rewrite or otherwise adjust your commits to include the changes
  • Loading branch information
Rasheed Abdul-Aziz committed Nov 4, 2021
1 parent 15f2122 commit bc05323
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,18 @@ copyright:
-ignore site/static/\*\* \
-ignore site/themes/\*\* \
.

.PHONY: pre-push .pre-push-check
.pre-push-check: copyright lint gen-manifests gen-objects test-gen-manifests test-gen-objects generate

# pre-push ensures that all generated content, copywrites and lints are
# run and ends with an error if a mutation is caused.
#
# usage:
# 1. with all your work added and committed (or stashed)
# 2. run `make pre-push && git push`
# 3. if any mutations occur, you can amend/rewrite or otherwise adjust your commits to include the changes
pre-push:
[ -z "$$(git status --porcelain)" ] || (echo "not everything is committed, failing" && exit 1)
$(MAKE) .pre-push-check
[ -z "$$(git status --porcelain)" ] || (echo "changes occurred during pre-push check" && git diff HEAD --exit-code)

0 comments on commit bc05323

Please sign in to comment.