Skip to content

Commit

Permalink
feat: allow lintPullRequestTitleWithConventionalCommit to be a regexp…
Browse files Browse the repository at this point in the history
…, change elax config
  • Loading branch information
christophehurpeau committed Apr 12, 2024
1 parent 1634b54 commit fdf1070
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/accountConfigs/Elax-Energie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Config } from './types';
const config: Config<never> = {
autoAssignToCreator: true,
cleanTitle: 'conventionalCommit',
lintPullRequestTitleWithConventionalCommit: true,
lintPullRequestTitleWithConventionalCommit: /^(aquastats)$/,
requiresReviewRequest: true,
prDefaultOptions: {
autoMerge: false,
Expand Down
2 changes: 1 addition & 1 deletion src/accountConfigs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ interface WarnOnForcePushAfterReviewStarted {
export interface Config<TeamNames extends string> {
autoAssignToCreator?: boolean;
cleanTitle?: boolean | 'conventionalCommit';
lintPullRequestTitleWithConventionalCommit?: boolean;
lintPullRequestTitleWithConventionalCommit?: RegExp | boolean;
ignoreRepoPattern?: string;
requiresReviewRequest?: boolean;
autoMergeRenovateWithSkipCi?: boolean;
Expand Down
9 changes: 8 additions & 1 deletion src/events/pr-handlers/actions/editOpenedPR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ export const editOpenedPR = async <
const statuses: ReviewflowStatus[] = [];
let errorStatus: StatusInfo | undefined;

if (repoContext.config.lintPullRequestTitleWithConventionalCommit) {
if (
repoContext.config.lintPullRequestTitleWithConventionalCommit === true ||
(repoContext.config.lintPullRequestTitleWithConventionalCommit &&
repoContext.config.lintPullRequestTitleWithConventionalCommit.test &&
repoContext.config.lintPullRequestTitleWithConventionalCommit.test(
repoContext.repoEmbed.name,
))
) {
try {
const lintOutcome = await lintCommitMessage(title);
if (!lintOutcome.valid) {
Expand Down

0 comments on commit fdf1070

Please sign in to comment.