Skip to content

Commit 9fc19b6

Browse files
authored
chore: add co-author to generated commit (#3980)
1 parent a934c4e commit 9fc19b6

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

scripts/ci/codegen/pushGeneratedCode.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,22 @@ export async function pushGeneratedCode(): Promise<void> {
5353
return;
5454
}
5555

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

69-
message += authors;
62+
const commitMessage = await run(
63+
`git show -s ${baseBranch} --format="${baseMessage}
64+
65+
Co-authored-by: %an <%ae>
66+
%(trailers:key=Co-authored-by)"`,
67+
);
7068

7169
console.log(`Pushing code to generated branch: '${branchToPush}'`);
7270
await run('git add .');
73-
await run(`git commit -m "${message.replaceAll('"', '\\"')}"`);
71+
await run(`git commit -m "${commitMessage.replaceAll('"', '\\"')}"`);
7472
await run(`git push origin ${branchToPush}`);
7573

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

0 commit comments

Comments
 (0)