Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HUSKY_SKIP_HOOKS env var to skip running hooks (#492)
* Add HUSKY_SKIP_HOOKS env var to skip running hooks * Add test for HUSKY_SKIP_HOOKS * Add documentation for HUSKY_SKIP_HOOKS
- Loading branch information
Showing
5 changed files
with
60 additions
and
30 deletions.
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,25 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const filename = path.join(__dirname, '../ci-post-checkout') | ||
|
||
if (fs.existsSync(filename)) { | ||
const data = fs.readFileSync(filename, 'utf-8') | ||
|
||
if (data.split(' ').length !== 3) { | ||
console.log('Not all params were set in HUSKY_GIT_PARAMS') | ||
console.log('Got', data) | ||
process.exit(1) | ||
} | ||
|
||
fs.unlinkSync(filename) | ||
console.log( | ||
'.git/hooks/post-checkout script has run, hooks were not skipped.' | ||
) | ||
process.exit(1) | ||
} else { | ||
console.log( | ||
'.git/hooks/post-checkout script has not run, hooks were successfully skipped.' | ||
) | ||
} |
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