Skip to content

Commit ed420e5

Browse files
fix(scripts): escape "double quotes" (#3920)
Co-authored-by: algolia-bot <[email protected]>
1 parent fa55c04 commit ed420e5

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

scripts/ci/codegen/pushGeneratedCode.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export async function pushGeneratedCode(): Promise<void> {
4444
await run(`git push -d origin generated/${baseBranch} || true`);
4545

4646
console.log(`Creating branch for generated code: '${branchToPush}'`);
47-
await run(`git checkout -b ${branchToPush}`);
47+
await run(`git checkout -B ${branchToPush}`);
4848
}
4949

5050
if (!(await isUpToDate(baseBranch))) {
@@ -54,25 +54,22 @@ export async function pushGeneratedCode(): Promise<void> {
5454
return;
5555
}
5656

57-
const skipCi = isMainBranch ? '[skip ci]' : '';
58-
let message = await run(`git show -s ${baseBranch} --format="%s ${text.commitEndMessage} ${skipCi}"`);
59-
const authors = await run(
60-
`git show -s ${baseBranch} --format="
57+
let skipCi = '';
58+
if (IS_RELEASE_COMMIT || isMainBranch) {
59+
console.log('Processing release commit');
60+
skipCi = '[skip ci]';
61+
}
62+
63+
const commitMessage = await run(
64+
`git show -s ${baseBranch} --format="%s ${text.commitEndMessage} ${skipCi}
6165
6266
Co-authored-by: %an <%ae>
6367
%(trailers:key=Co-authored-by)"`,
6468
);
6569

66-
if (IS_RELEASE_COMMIT && isMainBranch) {
67-
console.log('Processing release commit');
68-
message = `${text.commitReleaseMessage} [skip ci]`;
69-
}
70-
71-
message += authors;
72-
7370
console.log(`Pushing code to generated branch: '${branchToPush}'`);
7471
await run('git add .');
75-
await run(`git commit -m "${message}"`);
72+
await run(`git commit -m "${commitMessage.replaceAll('"', '\\"')}"`);
7673
await run(`git push origin ${branchToPush}`);
7774

7875
setOutput('GENERATED_COMMIT', await run('git rev-parse HEAD'));

0 commit comments

Comments
 (0)