Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
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
12 changes: 8 additions & 4 deletions .github/actions/conventional-pr/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const validTypes = [
'ci',
'chore',
'revert',
'release',
];

const typeList = validTypes.map(t => ` - ${t}`).join('\n');
Expand All @@ -28,22 +29,25 @@ export function validateTitle(title: string): ValidationResult {
const hastype = validTypes.some(t => title.startsWith(`${t}: `));

if (!hastype) {
core.info(
`[Title] Missing type in title. Choose from the following:\n${typeList}`
errors.push(
`[Title] Must start with type (ex. 'feat: ').\nThe valid types are:\n${typeList}`
);
errors.push("[Title] Must start with type. i.e. 'feat: '");
}

return errors;
}

const refMatch = /(refs?|close(d|s)?|fix(ed|es)?) \#\d+/i;
const helpLink =
'https://help.github.com/en/github/managing-your-work-on-github/closing-issues-using-keywords';

export function validateBody(body: string): ValidationResult {
let errors: ValidationResult = [];

if (!refMatch.test(body)) {
errors.push('[Body] Must reference an issue.');
errors.push(
`[Body] Must reference an issue (ex. 'fixes #1234').\nSee ${helpLink} for more details.`
);
}

return errors;
Expand Down