-
Notifications
You must be signed in to change notification settings - Fork 194
make a webhook to remind us to run the needful make commands #4659
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||||||
| LC_ALL=C | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| echo "Before pushing commits, ensure you've run the required make commands:" | ||||||||||||||||||||||||||||||||||||
| echo " - make generate" | ||||||||||||||||||||||||||||||||||||
| echo " - make imports" | ||||||||||||||||||||||||||||||||||||
| read -r -p "Have you run all required make commands? [y/N] " run_make_commands | ||||||||||||||||||||||||||||||||||||
| if [[ ! "${run_make_commands}" =~ ^([yY][eE][sS]|[yY])$ ]]; then | ||||||||||||||||||||||||||||||||||||
| echo "Commit aborted. Run the required make commands and try again." | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
| echo "Commit aborted. Run the required make commands and try again." | |
| echo "Push aborted. Run the required make commands and try again." |
Copilot
AI
Mar 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-push hooks receive the list of refs to push on stdin. Using read -p without redirecting will read from that stdin (consuming a ref line) instead of from the user, which can cause the hook to abort pushes unexpectedly (often every time). Read the confirmation from /dev/tty (or similar) and/or guard for non-interactive environments so pushes from automation/IDEs don't hang or fail due to EOF.
| read -r -p "Have you run all required make commands? [y/N] " run_make_commands | |
| if [[ ! "${run_make_commands}" =~ ^([yY][eE][sS]|[yY])$ ]]; then | |
| echo "Commit aborted. Run the required make commands and try again." | |
| exit 1 | |
| # Only prompt when an interactive terminal is available. | |
| if [ -t 0 ] || [ -t 1 ]; then | |
| # Read from /dev/tty so we don't consume Git's stdin (the list of refs). | |
| if ! read -r -p "Have you run all required make commands? [y/N] " run_make_commands </dev/tty; then | |
| # If we cannot read from the terminal, allow the push to proceed. | |
| exit 0 | |
| fi | |
| if [[ ! "${run_make_commands}" =~ ^([yY][eE][sS]|[yY])$ ]]; then | |
| echo "Commit aborted. Run the required make commands and try again." | |
| exit 1 | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot's comment here makes sense to me, but we're probably fine without it. I can't imagine when/why we'd want automation pushing to this repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Did you mean to put this here? Asking since you removed it from the existing pre-commit hook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elaborating on the second point:
git status --porcelainto detect modified or untracked filesPS: I always have some modified/untracked files on my local, so I would not prefer this flow. But a suggestion.
I believe asking every time during push is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to have to maintain all the required make commands within the script hence this implementation just being a nag vs total automation.