Skip to content

Commit

Permalink
chore: set git user when authoring release commit (#1385)
Browse files Browse the repository at this point in the history
<!-- For Coveo Employees only. Fill this section.

CDX-XXX

-->

## Proposed changes

<!--
Explains what are you changing in the code and provide links to relevant
issues.
This doesn't need to be over-technical, a good summary of the issues
with good explanations of the decisions should be enough.
 -->

## Breaking changes

<!--
    Remove this section if the PR does not include any breaking change

If your changes includes some breaking changes in the code, thoroughly
explains:
        - What are the breaking changes programmatically speaking.
- What is the impact on the end-user (e.g. user cannot do X anymore).
        - What motivates those changes.
-->

## Testing

- [ ] Unit Tests:
<!-- Did you write unit tests for your feature? If not, explains why?
-->
- [ ] Functionnal Tests:
<!-- Did you write functionnal tests for your feature? If not, explains
why? -->
- [ ] Manual Tests:
<!-- How did you test your changeset?  -->
  • Loading branch information
louis-bompart committed Oct 27, 2023
1 parent 6aa6a86 commit dc83724
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions utils/release/git-publish-all.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.
*/
Expand All @@ -43,8 +58,8 @@ function updateRootReadme() {
if (!cliUsage) {
return;
}
rootReadme.replace(usageRegExp, cliUsage);
writeFileSync('README.md', rootReadme);

writeFileSync('README.md', rootReadme.replace(usageRegExp, cliUsage));
}

/**
Expand Down Expand Up @@ -143,6 +158,8 @@ const octokit = new Octokit({
});
//#endregion

await setupGit();

// Define release # andversion
const currentVersionTag = getCurrentVersion(PATH);
currentVersionTag.inc('prerelease');
Expand Down

0 comments on commit dc83724

Please sign in to comment.