From 55485713a30e6c168e0e7a762b1b313a9bb6e67b Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Thu, 17 Sep 2020 10:17:08 -0700 Subject: [PATCH] fix(dev-infra): skip husky git commit hooks while merging pull requests (#38888) During the merge process, all validations have already been completed so git commit hooks can be safely skipped. This additionally, prevents errors from occuring which would be caused the commit hooks executing, such as when yarn updates and then yarn commands are unable to run within the same process. PR Close #38888 --- dev-infra/pr/merge/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dev-infra/pr/merge/index.ts b/dev-infra/pr/merge/index.ts index 4a6f5a5fd5..3f53b3d85e 100644 --- a/dev-infra/pr/merge/index.ts +++ b/dev-infra/pr/merge/index.ts @@ -33,6 +33,10 @@ import {MergeResult, MergeStatus, PullRequestMergeTask} from './task'; export async function mergePullRequest( prNumber: number, githubToken: string, projectRoot: string = getRepoBaseDir(), config?: MergeConfigWithRemote) { + // Set the environment variable to skip all git commit hooks triggered by husky. We are unable to + // rely on `---no-verify` as some hooks still run, notably the `prepare-commit-msg` hook. + process.env['HUSKY_SKIP_HOOKS'] = '1'; + const api = await createPullRequestMergeTask(githubToken, projectRoot, config); // Perform the merge. Force mode can be activated through a command line flag.