From ee91a5f446e594536472d651a5d1c3b926b5605c Mon Sep 17 00:00:00 2001 From: Louis Bompart Date: Fri, 27 Oct 2023 02:17:58 -0400 Subject: [PATCH] chore: set git user when authoring release commit --- utils/release/git-publish-all.mjs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/utils/release/git-publish-all.mjs b/utils/release/git-publish-all.mjs index 898b408908..010153fa9b 100755 --- a/utils/release/git-publish-all.mjs +++ b/utils/release/git-publish-all.mjs @@ -22,6 +22,8 @@ import { gitPublishBranch, gitSetRefOnCommit, gitPush, + gitSetupSshRemote, + gitSetupUser, } from '@coveo/semantic-monorepo-tools'; import {Octokit} from 'octokit'; import {createAppAuth} from '@octokit/auth-app'; @@ -32,6 +34,19 @@ import {readFileSync, writeFileSync} from 'fs'; import {removeWriteAccessRestrictions} from './lock-master.mjs'; import {spawnSync} from 'child_process'; +const setupGit = async () => { + const GIT_USERNAME = 'developer-experience-bot[bot]'; + const GIT_EMAIL = + '91079284+developer-experience-bot[bot]@users.noreply.github.com'; + const DEPLOY_KEY = process.env.DEPLOY_KEY; + if (DEPLOY_KEY === undefined) { + throw new Error('Deploy key is undefined'); + } + + await gitSetupUser(GIT_USERNAME, GIT_EMAIL); + await gitSetupSshRemote(REPO_OWNER, REPO_NAME, DEPLOY_KEY, GIT_SSH_REMOTE); +}; + /** * Update usage section at the root readme. */ @@ -43,8 +58,8 @@ function updateRootReadme() { if (!cliUsage) { return; } - rootReadme.replace(usageRegExp, cliUsage); - writeFileSync('README.md', rootReadme); + + writeFileSync('README.md', rootReadme.replace(usageRegExp, cliUsage)); } /** @@ -143,6 +158,8 @@ const octokit = new Octokit({ }); //#endregion +await setupGit(); + // Define release # andversion const currentVersionTag = getCurrentVersion(PATH); currentVersionTag.inc('prerelease');