Skip to content

fix(scripts): mention generated is spread msg commit #3421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scripts/ci/codegen/__tests__/spreadGeneration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('spread generation', () => {
expect(
cleanUpCommitMessage('feat(ci): make ci push generated code (#244)', '')
).toEqual(
`feat(ci): make ci push generated code\n\nhttps://github.com/algolia/api-clients-automation/pull/244`
`feat(ci): make ci push generated code (generated)\n\nhttps://github.com/algolia/api-clients-automation/pull/244`
);
});

Expand All @@ -26,17 +26,17 @@ describe('spread generation', () => {
it('cleans up correctly even if the title contains a url', () => {
const commitMessage = `fix(java): solve oneOf using a custom generator https://algolia.atlassian.net/browse/APIC-123 (#200)`;
expect(cleanUpCommitMessage(commitMessage, '')).toMatchInlineSnapshot(`
"fix(java): solve oneOf using a custom generator https://algolia.atlassian.net/browse/APIC-123
"fix(java): solve oneOf using a custom generator https://algolia.atlassian.net/browse/APIC-123 (generated)

https://github.com/algolia/api-clients-automation/pull/200"
`);
});

it('generated commits have a link to the origin pull request', () => {
expect(
cleanUpCommitMessage('feat(ci): make ci push generated code (#244) (generated).', '')
cleanUpCommitMessage('feat(ci): make ci push generated code (#244) (generated)', '')
).toEqual(
`feat(ci): make ci push generated code\n\nhttps://github.com/algolia/api-clients-automation/pull/244`
`feat(ci): make ci push generated code (generated)\n\nhttps://github.com/algolia/api-clients-automation/pull/244`
);
});
});
Expand Down
6 changes: 4 additions & 2 deletions scripts/ci/codegen/spreadGeneration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getNewReleasedTag } from '../../release/common.js';
import type { Language } from '../../types.js';
import { cloneRepository, getNbGitDiff } from '../utils.js';

import { commitStartRelease } from './text.js';
import text, { commitStartRelease } from './text.js';

export function cleanUpCommitMessage(commitMessage: string, version: string): string {
if (commitMessage.startsWith(commitStartRelease)) {
Expand All @@ -31,7 +31,9 @@ export function cleanUpCommitMessage(commitMessage: string, version: string): st
return commitMessage;
}

return [prCommit[1], `${REPO_URL}/pull/${prCommit[2]}`].join('\n\n');
return [`${prCommit[1]} ${text.commitEndMessage}`, `${REPO_URL}/pull/${prCommit[2]}`].join(
'\n\n',
);
}

async function spreadGeneration(): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/codegen/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TODAY } from '../../common.js';
export const commitStartPrepareRelease = 'chore: prepare release';
export const commitStartRelease = 'chore: release';

const commitEndMessage = '(generated).';
const commitEndMessage = '(generated)';

export default {
commitEndMessage,
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/__tests__/createReleasePR.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('createReleasePR', () => {
await parseCommit(
buildTestCommit({
type: 'feat(specs)',
message: 'foo bar baz (generated).',
message: 'foo bar baz (generated)',
})
)
).toEqual({
Expand Down
Loading