Skip to content

Commit 1a8e934

Browse files
chore(check-pr): Check uppercase in PR-title postamble and allow ai-cloud-sdk references (#6615)
--------- Co-authored-by: sap-cloud-sdk-bot[bot] <274190970+sap-cloud-sdk-bot[bot]@users.noreply.github.com>
1 parent 9218f7e commit 1a8e934

3 files changed

Lines changed: 28 additions & 3 deletions

File tree

.github/actions/check-pr/index.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-packages/check-pr/validators.spec.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('check-pr', () => {
4343

4444
describe('validateTitle', () => {
4545
it('should validate title with proper structure', async () => {
46-
await validateTitle('chore: test');
46+
await validateTitle('chore: Test');
4747
expect(setFailed).not.toHaveBeenCalled();
4848
});
4949

@@ -68,6 +68,13 @@ describe('check-pr', () => {
6868
);
6969
});
7070

71+
it('should invalidate title not starting with uppercase', async () => {
72+
await validateTitle('chore: test');
73+
expect(setFailed).toHaveBeenCalledWith(
74+
'PR title must start with an uppercase letter.'
75+
);
76+
});
77+
7178
it('should invalidate title with wrong commit type', async () => {
7279
await validateTitle('featt: test');
7380
expect(setFailed).toHaveBeenCalledWith(
@@ -152,6 +159,15 @@ describe('check-pr', () => {
152159
expect(setFailed).not.toHaveBeenCalled();
153160
});
154161

162+
it('should validate with @sap-ai-sdk scope', async () => {
163+
const fileContents = [
164+
"'@sap-ai-sdk/core': major",
165+
'[Fixed Issue] Something is fixed.'
166+
];
167+
validateChangesets('chore!', '', true, fileContents);
168+
expect(setFailed).not.toHaveBeenCalled();
169+
});
170+
155171
it('should validate with markdown link annotation', async () => {
156172
const fileContents = [
157173
'"@sap-cloud-sdk/generator": major',

build-packages/check-pr/validators.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export function validatePostamble(title: string | undefined): void {
6262
return setFailed('Space missing after conventional commit preamble.');
6363
}
6464

65+
if (title[1] !== title[1].toUpperCase()) {
66+
return setFailed('PR title must start with an uppercase letter.');
67+
}
68+
6569
info('✓ Title: OK');
6670
}
6771

@@ -85,7 +89,9 @@ function hasMatchingChangeset(
8589
if (allowedBumps.length) {
8690
return changedFileContents.some(fileContent =>
8791
allowedBumps.some(bump =>
88-
new RegExp(`("|')@sap-cloud-sdk/.*("|'): ${bump}`).test(fileContent)
92+
new RegExp(`("|')(@sap-cloud-sdk|@sap-ai-sdk)/.*("|'): ${bump}`).test(
93+
fileContent
94+
)
8995
)
9096
);
9197
}

0 commit comments

Comments
 (0)