Skip to content

Commit

Permalink
feat: pr from bot jira-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed May 20, 2019
1 parent 024d7e7 commit f2441fd
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 12 deletions.
16 changes: 13 additions & 3 deletions dist/index-node10-dev.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index-node10-dev.cjs.js.map

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions dist/index-node10.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index-node10.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/pr-handlers/actions/editOpenedPR.ts
Expand Up @@ -53,7 +53,7 @@ export const editOpenedPR = async (
if (rule.status && rule.statusInfoFromMatch) {
statuses.push({
name: rule.status,
info: rule.statusInfoFromMatch(match),
info: rule.statusInfoFromMatch(match, { bot: isPrFromBot }),
});
return false;
}
Expand Down
9 changes: 7 additions & 2 deletions src/teamconfigs/ornikar.ts
Expand Up @@ -22,14 +22,19 @@ const config: Config<'dev' | 'design'> = {
},
},
{
bot: false,
regExp: /\s(ONK-(\d+)|\[no issue])$/,
error: {
title: 'Title does not have JIRA issue',
summary: 'The PR title should end with ONK-0000, or [no issue]',
},
status: 'jira-issue',
statusInfoFromMatch: (match) => {
statusInfoFromMatch: (match, { bot }) => {
if (bot) {
return {
title: 'PR from bot',
summary: '',
};
}
const issue = match[1];
if (issue === '[no issue]') {
return {
Expand Down
9 changes: 8 additions & 1 deletion src/teamconfigs/types.ts
Expand Up @@ -15,13 +15,20 @@ export interface Group {
[userName: string]: string;
}

export interface StatusInfoFromMatchOptions {
bot: boolean;
}

export interface ParsePRRule {
bot?: false;
regExp: RegExp;
error: StatusError;

status?: string;
statusInfoFromMatch?: (match: RegExpMatchArray) => StatusInfo;
statusInfoFromMatch?: (
match: RegExpMatchArray,
options: StatusInfoFromMatchOptions,
) => StatusInfo;
}

export interface ParsePR {
Expand Down

0 comments on commit f2441fd

Please sign in to comment.