Skip to content

Commit 8650fe4

Browse files
authored
chore: make codegen message cleaner (#293)
1 parent 789ed02 commit 8650fe4

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

scripts/ci/codegen/__tests__/codegen.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ describe('codegen', () => {
4848
describe('getCommentBody', () => {
4949
it('returns the right comment for a `notification` trigger', async () => {
5050
expect(await getCommentBody('notification')).toMatchInlineSnapshot(`
51-
"🔨 The codegen job will run at the end of the CI.
51+
"### 🔨 The codegen job will run at the end of the CI.
5252
5353
_Make sure your last commit does not contains generated code, it will be automatically pushed by our CI._"
5454
`);
5555
});
5656

5757
it('returns the right comment for a `noGen` trigger', async () => {
5858
expect(await getCommentBody('noGen')).toMatchInlineSnapshot(`
59-
"✗ No code generated.
59+
"### ✗ No code generated.
6060
6161
_If you believe this is an issue on our side, please [open an issue](https://github.com/algolia/api-clients-automation/issues/new?template=Bug_report.md)._"
6262
`);
6363
});
6464

6565
it('returns the right comment for a `cleanup` trigger', async () => {
6666
expect(await getCommentBody('cleanup')).toMatchInlineSnapshot(`
67-
"✗ The generated branch has been deleted.
67+
"### ✗ The generated branch has been deleted.
6868
6969
If the PR has been merged, you can check the generated code on the [\`generated/main\` branch](https://github.com/algolia/api-clients-automation/tree/generated/main)."
7070
`);
@@ -80,8 +80,13 @@ describe('codegen', () => {
8080
'theGeneratedCommit'
8181
)
8282
).toMatchInlineSnapshot(`
83-
"🔨 Triggered by commit [myCommit](https://github.com/algolia/api-clients-automation/pull/42/commits/myCommit).
84-
🔍 Browse the generated code on branch [myBranch](https://github.com/algolia/api-clients-automation/tree/myBranch): [theGeneratedCommit](https://github.com/algolia/api-clients-automation/commit/theGeneratedCommit)."
83+
"
84+
| Name | Link |
85+
|---------------------------------|------------------------|
86+
| 🔨 Triggered by | [\`myCommit\`](https://github.com/algolia/api-clients-automation/pull/42/commits/myCommit) |
87+
| 🔍 Generated code | [\`theGeneratedCommit\`](https://github.com/algolia/api-clients-automation/commit/theGeneratedCommit) |
88+
| 🌲 Generated branch | [\`myBranch\`](https://github.com/algolia/api-clients-automation/tree/myBranch) |
89+
"
8590
`);
8691
});
8792
});

scripts/ci/codegen/text.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,32 @@ const REPO_URL = `https://github.com/${OWNER}/${REPO}`;
44

55
export default {
66
notification: {
7-
header: '🔨 The codegen job will run at the end of the CI.',
7+
header: '### 🔨 The codegen job will run at the end of the CI.',
88
body: '_Make sure your last commit does not contains generated code, it will be automatically pushed by our CI._',
99
},
1010
noGen: {
11-
header: '✗ No code generated.',
11+
header: '### ✗ No code generated.',
1212
body: `_If you believe this is an issue on our side, please [open an issue](${REPO_URL}/issues/new?template=Bug_report.md)._`,
1313
},
1414
cleanup: {
15-
header: '✗ The generated branch has been deleted.',
15+
header: '### ✗ The generated branch has been deleted.',
1616
body: `If the PR has been merged, you can check the generated code on the [\`generated/main\` branch](${REPO_URL}/tree/generated/main).`,
1717
},
1818
codegen: {
19-
header: '✔️ Code generated!',
19+
header: '### ✔️ Code generated!',
2020
body(
2121
branch: string,
2222
commit: string,
2323
eventNumber: number,
2424
generatedCommit: string
2525
): string {
26-
return `🔨 Triggered by commit [${commit}](${REPO_URL}/pull/${eventNumber}/commits/${commit}).
27-
🔍 Browse the generated code on branch [${branch}](${REPO_URL}/tree/${branch}): [${generatedCommit}](${REPO_URL}/commit/${generatedCommit}).`;
26+
return `
27+
| Name | Link |
28+
|---------------------------------|------------------------|
29+
| 🔨 Triggered by | [\`${commit}\`](${REPO_URL}/pull/${eventNumber}/commits/${commit}) |
30+
| 🔍 Generated code | [\`${generatedCommit}\`](${REPO_URL}/commit/${generatedCommit}) |
31+
| 🌲 Generated branch | [\`${branch}\`](${REPO_URL}/tree/${branch}) |
32+
`;
2833
},
2934
},
3035
};

0 commit comments

Comments
 (0)