Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(snapshot): ensure git author is known when committing (#1405)
https://coveord.atlassian.net/browse/CDX-1505 ## Proposed changes Use a local git user when doing a commit for the expanded preview. ## 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 - [x] Unit Tests: - [x] Manual Tests: - Setup a containerized enviro with Ubuntu 22 LTS. - Install Node 20 LTS - Install the CLI with `npm`: `npm i -g @coveo/cli` - Run this: ```coveo auth:login or whatever to auth coveo org:create foobar mkdir testdir cd testdir coveo org:resources:pull coveo org:resources:push ``` - Assert error - Modify `~/.nvm/versions/node/v20.10.0/lib/node_modules/@coveo/cli/lib/lib/snapshot/expandedPreviewer/expandedPreviewer.js` or wherever is the `expandedPreviewer.js` file to 🐒 patch the `initialPreviewCommit` method: ```patch async initialPreviewCommit(dirPath) { await (0, process_1.spawnProcess)('git', ['init'], { cwd: dirPath, stdio: 'ignore' }); + await (0, process_1.spawnProcess)('git', ['config', 'user.email', '"[email protected]"'], {cwd: dirPath, stdio: 'ignore'}); + await (0, process_1.spawnProcess)('git', ['config', 'user.name', '"Coveo CLI"'], {cwd: dirPath, stdio: 'ignore'}); await (0, process_1.spawnProcess)('git', ['add', '.'], { cwd: dirPath, stdio: 'ignore' }); await (0, process_1.spawnProcess)('git', ['commit', `--message=${this.orgId} currently`], { cwd: dirPath, stdio: 'ignore', }); } ``` - Rerun `coveo org:resources:push`, assert proper execution.
- Loading branch information