-
Notifications
You must be signed in to change notification settings - Fork 89
ci: resolve husky pre-push and pre-commit errors #10365
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
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 |
|---|---|---|
| @@ -1,14 +1,20 @@ | ||
| #!/usr/bin/env bash | ||
| # from https://riptutorial.com/git/example/16164/pre-push | ||
|
|
||
| protected_branch="main" | ||
| current_branch=$(git rev-parse --abbrev-ref HEAD) | ||
|
|
||
| if [ "$protected_branch" = "$current_branch" ] && bash -c ': >/dev/tty'; then | ||
| read -p "You're about to push main, is that what you intended? [y|n] " -n 1 -r </dev/tty | ||
| echo | ||
| if echo "$REPLY" | grep -E "^[Yy]$" >/dev/null; then | ||
| exit 0 | ||
| fi | ||
| exit 1 | ||
| #!/usr/bin/env sh | ||
|
|
||
| if ! bash -c ': >/dev/tty'; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| current_branch="$(git rev-parse --abbrev-ref HEAD)" | ||
|
|
||
| case "$current_branch" in | ||
| dev | main | rc) | ||
| printf "You're about to push a protected branch, is that what you intended? [y|n] " | ||
| read -r response | ||
|
|
||
| case "$response" in | ||
| y | Y) exit 0 ;; | ||
| *) exit 1 ;; | ||
| esac | ||
| ;; | ||
| *) exit 0 ;; | ||
| esac |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ function collectSassFiles(dir: string): string[] { | |
|
|
||
| try { | ||
| fs.readdirSync(dir, { recursive: true, withFileTypes: true }).forEach(dirent => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to recursively check files starting in the root directory or can we be more specific? The only relevant directories are
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the suggestion to narrow the search scope mainly for performance reasons? I’d like to avoid an allowlist, so we don’t need to (remember to) update this script if our Sass file directories change. |
||
| const fullPath = path.join(dir, dirent.name); | ||
| const fullPath = path.join(dirent.parentPath, dirent.name); | ||
|
|
||
| if (dirent.isFile() && fullPath.endsWith('.scss')) { | ||
| sassFiles.push(fullPath); | ||
|
|
||
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.
🤦♂️ Thanks for fixing this one.