diff --git a/common/git-hooks/pre-push b/common/git-hooks/pre-push index b3805ae9955..ecc3ccd42f6 100755 --- a/common/git-hooks/pre-push +++ b/common/git-hooks/pre-push @@ -2,6 +2,10 @@ const { execSync } = require("child_process"); +function getEnvVariable(name) { + return process.env[name]; +} + function preparePrePushRemote() { try { execSync("git remote add prepush https://github.com/Azure/azure-sdk-for-js.git"); @@ -117,9 +121,14 @@ async function execute(listOfModifiedProjects, check_script, fix_script) { return false; } -console.log("Preparing the pre-push script....\n"); +console.log("Running the Pre Push Checks on your commits. You could skip these checks by setting SKIP_PREPUSH_CHECKS to true.\n"); async function main() { + const skipPrePushChecks = getEnvVariable('SKIP_PREPUSH_CHECKS'); + if (skipPrePushChecks !== undefined && skipPrePushChecks.trim().toLowerCase() === 'true') { + console.log("Skipping pre-push checks as SKIP_PREPUSH_CHECKS is set to true"); + process.exit(0); + } const localCommits = getLocalCommitsNotMerged(); if (localCommits.length != 0 && localCommits[0].trim() == "") { console.log("No local commits to push");