-
-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add husky pre-push script (#3061)
* chore: add husky pre-push script * skip pre-push on windows * change to node script * add inquirer as devdependency * add inquirer as devdependency
- Loading branch information
1 parent
3dbaa33
commit 9e9128f
Showing
4 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
BRANCH=`git rev-parse --abbrev-ref HEAD` | ||
PROTECTED_BRANCH="main" | ||
|
||
if [ "$BRANCH" = $PROTECTED_BRANCH ]; then | ||
node .husky/pre-push.js < /dev/tty | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const inquirer = require('inquirer'); | ||
|
||
const question = [ | ||
{ | ||
type: 'confirm', | ||
name: 'continuePush', | ||
message: '[pre-push hook] Warning: this is a protected branch. Continue?', | ||
}, | ||
]; | ||
|
||
inquirer.prompt(question).then((answer) => { | ||
if (!answer.continuePush) process.exit(1); | ||
process.exit(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters