feat(onboarding): Semantic onboarding PR (#25666)

This commit is contained in:
Sergei Zharinov 2023-11-10 03:35:42 -03:00 committed by GitHub
parent e9a2da0dfa
commit 9a55d753f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View file

@ -77,6 +77,23 @@ describe('workers/repository/onboarding/pr/index', () => {
expect(platform.createPr).toHaveBeenCalledTimes(1); expect(platform.createPr).toHaveBeenCalledTimes(1);
}); });
it('creates semantic PR', async () => {
await ensureOnboardingPr(
{
...config,
semanticCommitType: undefined, // should default to "chore"
semanticCommits: 'enabled',
},
packageFiles,
branches,
);
expect(platform.createPr).toHaveBeenCalledWith(
expect.objectContaining({
prTitle: 'chore: Configure Renovate',
}),
);
});
it('creates PR with labels', async () => { it('creates PR with labels', async () => {
await ensureOnboardingPr( await ensureOnboardingPr(
{ {

View file

@ -173,10 +173,16 @@ If you need any further assistance then you can also [request help here](${
logger.info('DRY-RUN: Would create onboarding PR'); logger.info('DRY-RUN: Would create onboarding PR');
} else { } else {
// TODO #22198 // TODO #22198
const prTitle =
config.semanticCommits === 'enabled'
? `${config.semanticCommitType ?? 'chore'}: ${
config.onboardingPrTitle
}`
: config.onboardingPrTitle!;
const pr = await platform.createPr({ const pr = await platform.createPr({
sourceBranch: config.onboardingBranch!, sourceBranch: config.onboardingBranch!,
targetBranch: config.defaultBranch!, targetBranch: config.defaultBranch!,
prTitle: config.onboardingPrTitle!, prTitle,
prBody, prBody,
labels, labels,
platformOptions: getPlatformPrOptions({ platformOptions: getPlatformPrOptions({