diff --git a/dist/index-node10-dev.cjs.js b/dist/index-node10-dev.cjs.js index 5d48023e8..18cf4f0c2 100644 --- a/dist/index-node10-dev.cjs.js +++ b/dist/index-node10-dev.cjs.js @@ -12,6 +12,7 @@ const config = { requiresReviewRequest: true, prDefaultOptions: { featureBranch: false, + autoMerge: false, deleteAfterMerge: true }, parsePR: { @@ -161,6 +162,7 @@ const config$1 = { requiresReviewRequest: false, prDefaultOptions: { featureBranch: false, + autoMerge: false, deleteAfterMerge: true }, parsePR: { @@ -246,7 +248,7 @@ const teamConfigs = { // return Object.values(groups).flat(1); // }; -const options = ['featureBranch', 'deleteAfterMerge']; +const options = ['featureBranch', 'autoMerge', 'deleteAfterMerge']; const optionsRegexps = options.map(option => ({ name: option, regexp: new RegExp(`\\[([ xX]?)]\\s*`) @@ -254,6 +256,9 @@ const optionsRegexps = options.map(option => ({ const optionsLabels = [{ name: 'featureBranch', label: 'This PR is a feature branch' +}, { + name: 'autoMerge', + label: 'Auto merge when this PR is ready and has no failed statuses. (Also has a queue per repo to prevent multiple useless "Update branch" triggers)' }, { name: 'deleteAfterMerge', label: 'Automatic branch delete after this PR is merged' @@ -937,8 +942,11 @@ const editOpenedPR = async (context, repoContext) => { description: errorRule ? errorRule.error.title : '✓ Your PR is valid' }))].filter(ExcludesFalsy$3)); const featureBranchLabel = repoContext.labels['feature-branch']; + const automergeLabel = repoContext.labels['merge/automerge']; const prHasFeatureBranchLabel = Boolean(featureBranchLabel && pr.labels.find(label => label.id === featureBranchLabel.id)); + const prHasAutoMergeLabel = Boolean(automergeLabel && pr.labels.find(label => label.id === automergeLabel.id)); const defaultOptions = { ...repoContext.config.prDefaultOptions, + autoMerge: prHasAutoMergeLabel, featureBranch: prHasFeatureBranchLabel }; const { @@ -964,17 +972,33 @@ const editOpenedPR = async (context, repoContext) => { await context.github.issues.update(context.issue(update)); } - if (options && featureBranchLabel) { - if (prHasFeatureBranchLabel && !options.featureBranch) { - await context.github.issues.removeLabel(context.issue({ - name: featureBranchLabel.name - })); + if (options && (featureBranchLabel || automergeLabel)) { + if (featureBranchLabel) { + if (prHasFeatureBranchLabel && !options.featureBranch) { + await context.github.issues.removeLabel(context.issue({ + name: featureBranchLabel.name + })); + } + + if (options.featureBranch && !prHasFeatureBranchLabel) { + await context.github.issues.addLabels(context.issue({ + labels: [featureBranchLabel.name] + })); + } } - if (options.featureBranch && !prHasFeatureBranchLabel) { - await context.github.issues.addLabels(context.issue({ - labels: [featureBranchLabel.name] - })); + if (automergeLabel) { + if (prHasAutoMergeLabel && !options.autoMerge) { + await context.github.issues.removeLabel(context.issue({ + name: automergeLabel.name + })); + } + + if (options.autoMerge && !prHasAutoMergeLabel) { + await context.github.issues.addLabels(context.issue({ + labels: [automergeLabel.name] + })); + } } } }; @@ -1393,16 +1417,16 @@ function labelsChanged(app) { } await updateStatusCheckFromLabels(context, repoContext); + const featureBranchLabel = repoContext.labels['feature-branch']; + const automergeLabel = repoContext.labels['merge/automerge']; - if (repoContext.labels['feature-branch'] && label.id === repoContext.labels['feature-branch'].id) { + if (featureBranchLabel && label.id === automergeLabel.id || automergeLabel && label.id === automergeLabel.id) { + const option = featureBranchLabel && label.id === automergeLabel.id ? 'featureBranch' : 'autoMerge'; const prBody = context.payload.pull_request.body; const { body - } = updateBody(prBody, { - featureBranch: false, - deleteAfterMerge: false - }, undefined, { - featureBranch: context.payload.action === 'labeled' + } = updateBody(prBody, repoContext.config.prDefaultOptions, undefined, { + [option]: context.payload.action === 'labeled' }); if (body !== prBody) { diff --git a/dist/index-node10-dev.cjs.js.map b/dist/index-node10-dev.cjs.js.map index 5812e9608..6bc5776d4 100644 --- a/dist/index-node10-dev.cjs.js.map +++ b/dist/index-node10-dev.cjs.js.map @@ -1 +1 @@ -{"version":3,"file":"index-node10-dev.cjs.js","sources":["../src/teamconfigs/ornikar.ts","../src/teamconfigs/christophehurpeau.ts","../src/teamconfigs/index.ts","../src/pr-handlers/actions/utils/prOptions.ts","../src/pr-handlers/actions/utils/parseBody.ts","../src/pr-handlers/actions/autoMergeIfPossible.ts","../src/context/initRepoLabels.ts","../src/context/utils.ts","../src/context/initTeamSlack.ts","../src/context/teamContext.ts","../src/context/repoContext.ts","../src/pr-handlers/utils.ts","../src/pr-handlers/actions/autoAssignPRToCreator.ts","../src/pr-handlers/actions/utils/cleanTitle.ts","../src/pr-handlers/actions/utils/updateBody.ts","../src/pr-handlers/actions/editOpenedPR.ts","../src/pr-handlers/actions/updateStatusCheckFromLabels.ts","../src/pr-handlers/actions/updateReviewStatus.ts","../src/pr-handlers/actions/autoApproveAndAutoMerge.ts","../src/pr-handlers/opened.ts","../src/pr-handlers/closed.ts","../src/pr-handlers/reviewRequested.ts","../src/pr-handlers/reviewRequestRemoved.ts","../src/pr-handlers/reviewSubmitted.ts","../src/pr-handlers/reviewDismissed.ts","../src/pr-handlers/synchronize.ts","../src/pr-handlers/edited.ts","../src/pr-handlers/labelsChanged.ts","../src/pr-handlers/checkrunCompleted.ts","../src/pr-handlers/checksuiteCompleted.ts","../src/pr-handlers/status.ts","../src/index.ts"],"sourcesContent":["import { Config } from './types';\n\nconst config: Config<'dev' | 'design'> = {\n slackToken: process.env.ORNIKAR_SLACK_TOKEN,\n autoAssignToCreator: true,\n trimTitle: true,\n requiresReviewRequest: true,\n prDefaultOptions: {\n featureBranch: false,\n deleteAfterMerge: true,\n },\n parsePR: {\n title: [\n {\n regExp:\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^(revert: )?(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\\(([a-z\\-/]*)\\))?:\\s/,\n error: {\n title: 'Title does not match commitlint conventional',\n summary:\n 'https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional',\n },\n },\n {\n bot: false,\n regExp: /\\s(ONK-(\\d+)|\\[no issue])$/,\n error: {\n title: 'Title does not have JIRA issue',\n summary: 'The PR title should end with ONK-0000, or [no issue]',\n },\n status: 'jira-issue',\n statusInfoFromMatch: (match) => {\n const issue = match[1];\n if (issue === '[no issue]') {\n return {\n title: 'No issue',\n summary: '',\n };\n }\n return {\n inBody: true,\n url: `https://ornikar.atlassian.net/browse/${issue}`,\n title: `JIRA issue: ${issue}`,\n summary: `[${issue}](https://ornikar.atlassian.net/browse/${issue})`,\n };\n },\n },\n ],\n },\n\n groups: {\n dev: {\n /* back */\n abarreir: `alexandre${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n arthurflachs: `arthur${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n CorentinAndre: `corentin${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n rigma: `romain${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n damienorny: `damien.orny${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n 'Thierry-girod': `thierry${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n darame07: `kevin${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n Pixy: `pierre-alexis${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n /* front */\n christophehurpeau: `christophe${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n HugoGarrido: `hugo${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n LentnerStefan: `stefan${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n Mxime: `maxime${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n tilap: `julien.lavinh${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n '63m29': `valerian${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n },\n design: {\n jperriere: `julien${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n CoralineColasse: `coraline${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n },\n },\n waitForGroups: {\n dev: [],\n design: ['dev'],\n },\n labels: {\n list: {\n // /* ci */\n // 'ci/in-progress': { name: ':green_heart: ci/in-progress', color: '#0052cc' },\n // 'ci/fail': { name: ':green_heart: ci/fail', color: '#e11d21' },\n // 'ci/passed': { name: ':green_heart: ci/passed', color: '#86f9b4' },\n\n /* code */\n 'code/needs-review': {\n name: ':ok_hand: code/needs-review',\n color: '#FFC44C',\n },\n 'code/review-requested': {\n name: ':ok_hand: code/review-requested',\n color: '#DAE1E6',\n },\n 'code/changes-requested': {\n name: ':ok_hand: code/changes-requested',\n color: '#e11d21',\n },\n 'code/approved': {\n name: ':ok_hand: code/approved',\n color: '#64DD17',\n },\n\n /* design */\n 'design/needs-review': {\n name: ':art: design/needs-review',\n color: '#FFC44C',\n },\n 'design/review-requested': {\n name: ':art: design/review-requested',\n color: '#DAE1E6',\n },\n 'design/changes-requested': {\n name: ':art: design/changes-requested',\n color: '#e11d21',\n },\n 'design/approved': {\n name: ':art: design/approved',\n color: '#64DD17',\n },\n\n /* auto merge */\n 'merge/automerge': {\n name: ':soon: automerge',\n color: '#64DD17',\n },\n\n /* feature-branch */\n 'feature-branch': {\n name: 'feature-branch',\n color: '#7FCEFF',\n },\n },\n\n review: {\n ci: {\n inProgress: 'ci/in-progress',\n succeeded: 'ci/success',\n failed: 'ci/fail',\n },\n dev: {\n needsReview: 'code/needs-review',\n requested: 'code/review-requested',\n changesRequested: 'code/changes-requested',\n approved: 'code/approved',\n },\n design: {\n needsReview: 'design/needs-review',\n requested: 'design/review-requested',\n changesRequested: 'design/changes-requested',\n approved: 'design/approved',\n },\n },\n },\n};\n\nexport default config;\n","import { Config } from './types';\n\nconst config: Config<'dev'> = {\n autoAssignToCreator: true,\n trimTitle: true,\n requiresReviewRequest: false,\n prDefaultOptions: {\n featureBranch: false,\n deleteAfterMerge: true,\n },\n parsePR: {\n title: [\n {\n regExp:\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^(revert: )?(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\\(([a-z\\-/]*)\\))?:\\s/,\n error: {\n title: 'Title does not match commitlint conventional',\n summary:\n 'https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional',\n },\n },\n ],\n },\n groups: {\n dev: {\n christophehurpeau: 'christophe@hurpeau.com',\n 'chris-reviewflow': 'christophe.hurpeau+reviewflow@gmail.com',\n tilap: 'jlavinh@gmail.com',\n },\n },\n waitForGroups: {\n dev: [],\n },\n labels: {\n list: {\n // /* ci */\n // 'ci/in-progress': { name: ':green_heart: ci/in-progress', color: '#0052cc' },\n // 'ci/fail': { name: ':green_heart: ci/fail', color: '#e11d21' },\n // 'ci/passed': { name: ':green_heart: ci/passed', color: '#86f9b4' },\n\n /* code */\n 'code/needs-review': {\n name: ':ok_hand: code/needs-review',\n color: '#FFD57F',\n },\n 'code/review-requested': {\n name: ':ok_hand: code/review-requested',\n color: '#B2E1FF',\n },\n 'code/changes-requested': {\n name: ':ok_hand: code/changes-requested',\n color: '#e11d21',\n },\n 'code/approved': {\n name: ':ok_hand: code/approved',\n color: '#64DD17',\n },\n\n /* auto merge */\n 'merge/automerge': {\n name: ':soon: automerge',\n color: '#64DD17',\n },\n\n /* feature-branch */\n 'feature-branch': {\n name: 'feature-branch',\n color: '#7FCEFF',\n },\n },\n\n review: {\n ci: {\n inProgress: 'ci/in-progress',\n succeeded: 'ci/success',\n failed: 'ci/fail',\n },\n dev: {\n needsReview: 'code/needs-review',\n requested: 'code/review-requested',\n changesRequested: 'code/changes-requested',\n approved: 'code/approved',\n },\n },\n },\n};\n\nexport default config;\n","import { Config as ConfigType } from './types';\nimport ornikar from './ornikar';\nimport christophehurpeau from './christophehurpeau';\n\nexport type Config = ConfigType;\n\nexport const teamConfigs: { [owner: string]: Config } = {\n ornikar,\n christophehurpeau,\n};\n\n// flat requires node 11\n// export const getMembers = (\n// groups: Record,\n// ): string[] => {\n// return Object.values(groups).flat(1);\n// };\n","export type Options = 'featureBranch' | 'deleteAfterMerge';\n\nexport const options: Options[] = ['featureBranch', 'deleteAfterMerge'];\nexport const optionsRegexps: { name: Options; regexp: RegExp }[] = options.map(\n (option) => ({\n name: option,\n regexp: new RegExp(`\\\\[([ xX]?)]\\\\s*`),\n }),\n);\n\nexport const optionsLabels: { name: Options; label: string }[] = [\n { name: 'featureBranch', label: 'This PR is a feature branch' },\n {\n name: 'deleteAfterMerge',\n label: 'Automatic branch delete after this PR is merged',\n },\n];\n","import { Options, optionsRegexps } from './prOptions';\n\nconst commentStart = '';\nconst commentEnd = \"\";\n\nconst regexpCols = /^(.*)((.*)).*$/is;\nconst regexpReviewflowCol = /^(\\s*<\\/td>]*>)\\s*(.*)\\s*(<\\/td><\\/tr><\\/table>\\s*)\\s*$/is;\n\nconst parseOptions = (\n content: string,\n defaultConfig: Record,\n): Record => {\n return optionsRegexps.reduce(\n (acc, { name, regexp }) => {\n const match = regexp.exec(content);\n acc[name] = !match\n ? defaultConfig[name] || false\n : match[1] === 'x' || match[1] === 'X';\n return acc;\n },\n {} as any,\n ) as Record;\n};\n\nexport const parseBody = (\n description: string,\n defaultConfig: Record,\n) => {\n const match = regexpCols.exec(description);\n if (!match) return null;\n const [, content, reviewFlowCol, reviewflowContent] = match;\n const reviewFlowColMatch = regexpReviewflowCol.exec(reviewFlowCol);\n if (!reviewFlowColMatch) {\n return {\n content,\n reviewflowContentCol: reviewflowContent,\n reviewflowContentColPrefix: commentStart,\n reviewflowContentColSuffix: commentEnd,\n options: parseOptions(reviewFlowCol, defaultConfig),\n };\n }\n const [\n ,\n reviewflowContentColPrefix,\n reviewflowContentCol,\n reviewflowContentColSuffix,\n ] = reviewFlowColMatch;\n\n return {\n content,\n reviewflowContentCol,\n reviewflowContentColPrefix,\n reviewflowContentColSuffix,\n options: parseOptions(reviewflowContentCol, defaultConfig),\n };\n};\n","/* eslint-disable max-lines */\nimport { Context } from 'probot';\n// eslint-disable-next-line import/no-cycle\nimport { RepoContext } from '../../context/repoContext';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { parseBody } from './utils/parseBody';\n\nconst hasFailedStatusOrChecks = async (\n context: Context,\n repoContext: RepoContext,\n pr: any,\n) => {\n const checks = await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n per_page: 100,\n }),\n );\n\n const failedChecks = checks.data.check_runs.filter(\n (check) => check.conclusion === 'failure',\n );\n\n if (failedChecks.length !== 0) {\n context.log.info(`automerge not possible: failed check pr ${pr.id}`, {\n checks: failedChecks.map((check) => check.name),\n });\n return true;\n }\n\n const combinedStatus = await context.github.repos.getCombinedStatusForRef(\n context.repo({\n ref: pr.head.sha,\n per_page: 100,\n }),\n );\n\n if (combinedStatus.data.state === 'failure') {\n const failedStatuses = combinedStatus.data.statuses.filter(\n (status) => status.state === 'failure' || status.state === 'error',\n );\n\n context.log.info(`automerge not possible: failed status pr ${pr.id}`, {\n statuses: failedStatuses.map((status) => status.context),\n });\n\n return true;\n }\n\n return false;\n};\n\nexport const autoMergeIfPossible = async (\n context: Context,\n repoContext: RepoContext,\n pr: any = context.payload.pull_request,\n prLabels: LabelResponse[] = pr.labels,\n): Promise => {\n const autoMergeLabel = repoContext.labels['merge/automerge'];\n if (!autoMergeLabel) return false;\n\n const createMergeLockPrFromPr = () => ({\n id: pr.id,\n number: pr.number,\n branch: pr.head.ref,\n });\n\n if (!prLabels.find((l): boolean => l.id === autoMergeLabel.id)) {\n context.log.debug('automerge not possible: no label');\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n }\n\n if (\n repoContext.hasNeedsReview(prLabels) ||\n repoContext.hasRequestedReview(prLabels)\n ) {\n context.log.debug('automerge not possible: blocking labels');\n // repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n }\n\n const lockedPr = repoContext.getMergeLockedPr();\n if (lockedPr && lockedPr.number !== pr.number) {\n context.log.info(`automerge not possible: locked pr ${pr.id}`);\n repoContext.pushAutomergeQueue(createMergeLockPrFromPr());\n return false;\n }\n\n repoContext.addMergeLockPr(createMergeLockPrFromPr());\n\n if (pr.mergeable === undefined) {\n const prResult = await context.github.pulls.get(\n context.repo({\n pull_number: pr.number,\n }),\n );\n pr = prResult.data;\n }\n\n if (pr.merged) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n context.log.info(`automerge not possible: already merged pr ${pr.id}`);\n return false;\n }\n\n context.log.info(\n `automerge?: ${pr.id}, mergeable=${pr.mergeable} state=${\n pr.mergeable_state\n }`,\n );\n\n // https://github.com/octokit/octokit.net/issues/1763\n if (\n !(\n pr.mergeable_state === 'clean' ||\n pr.mergeable_state === 'has_hooks' ||\n pr.mergeable_state === 'unstable'\n )\n ) {\n if (!pr.mergeable_state || pr.mergeable_state === 'unknown') {\n context.log.info(`automerge not possible: rescheduling ${pr.id}`);\n // GitHub is determining whether the pull request is mergeable\n repoContext.reschedule(context, createMergeLockPrFromPr());\n return false;\n }\n\n if (pr.head.ref.startsWith('renovate/')) {\n if (pr.mergeable_state === 'behind' || pr.mergeable_state === 'dirty') {\n context.log.info(\n `automerge not possible: rebase renovate branch pr ${pr.id}`,\n );\n // TODO check if has commits not made by renovate https://github.com/ornikar/shared-configs/pull/47#issuecomment-445767120\n\n await context.github.issues.update(\n context.repo({\n number: pr.number,\n body: pr.body.replace(\n '[ ] ',\n '[x] ',\n ),\n }),\n );\n return false;\n }\n\n if (await hasFailedStatusOrChecks(context, repoContext, pr)) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n } else if (pr.mergeable_state === 'blocked') {\n // waiting for reschedule in status (pr-handler/status.ts)\n return false;\n }\n\n context.log.info(\n `automerge not possible: renovate with mergeable_state=${\n pr.mergeable_state\n }`,\n );\n return false;\n }\n\n if (pr.mergeable_state === 'blocked') {\n if (await hasFailedStatusOrChecks(context, repoContext, pr)) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n } else {\n // waiting for reschedule in status (pr-handler/status.ts)\n return false;\n }\n }\n\n if (pr.mergeable_state === 'behind') {\n context.log.info('automerge not possible: update branch', {\n head: pr.head.ref,\n base: pr.base.ref,\n });\n\n await context.github.repos.merge({\n owner: pr.head.repo.owner.login,\n repo: pr.head.repo.name,\n head: pr.base.ref,\n base: pr.head.ref,\n });\n\n return false;\n }\n\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n context.log.info(\n `automerge not possible: not mergeable mergeable_state=${\n pr.mergeable_state\n }`,\n );\n return false;\n }\n\n try {\n context.log.info(`automerge pr #${pr.number}`);\n const parsedBody = parseBody(pr.body, repoContext.config.prDefaultOptions);\n const mergeResult = await context.github.pulls.merge({\n merge_method:\n parsedBody && parsedBody.options.featureBranch ? 'merge' : 'squash',\n owner: pr.head.repo.owner.login,\n repo: pr.head.repo.name,\n pull_number: pr.number,\n commit_title: `${pr.title} (#${pr.number})`,\n commit_message: '', // TODO add BC\n });\n context.log.debug('merge result:', mergeResult.data);\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return Boolean(mergeResult.data.merged);\n } catch (err) {\n context.log.info('could not merge:', err.message);\n repoContext.reschedule(context, createMergeLockPrFromPr());\n return false;\n }\n};\n","import { Context } from 'probot';\nimport { Config } from '../teamconfigs';\n\nexport interface LabelResponse {\n id: number;\n node_id: string;\n url: string;\n name: string;\n description: string;\n color: string;\n default: boolean;\n}\n\nexport interface Labels {\n [key: string]: LabelResponse;\n}\n\nexport const initRepoLabels = async (\n context: Context,\n config: Config,\n): Promise => {\n const { data: labels } = await context.github.issues.listLabelsForRepo(\n context.repo({ per_page: 100 }),\n );\n const finalLabels: Record = {};\n\n for (const [labelKey, labelConfig] of Object.entries(config.labels.list)) {\n const labelColor = labelConfig.color.slice(1);\n const description = `Generated by review-flow for ${labelKey}`;\n\n let existingLabel = labels.find((label) => label.name === labelConfig.name);\n if (!existingLabel) {\n existingLabel = labels.find((label) => label.description === description);\n }\n if (!existingLabel) {\n if (labelKey === 'design/needs-review') {\n existingLabel = labels.find(\n (label) => label.name === 'needs-design-review',\n );\n }\n if (labelKey === 'design/approved') {\n existingLabel = labels.find(\n (label) => label.name === 'design-reviewed',\n );\n }\n }\n\n if (!existingLabel) {\n const result = await context.github.issues.createLabel(\n context.repo({\n name: labelConfig.name,\n color: labelColor,\n description,\n }),\n );\n finalLabels[labelKey] = result.data;\n } else if (\n existingLabel.name !== labelConfig.name ||\n existingLabel.color !== labelColor // ||\n // TODO: description is never updated\n // existingLabel.description !== description\n ) {\n context.log.info('Needs to update label', {\n current_name: existingLabel.name,\n name: existingLabel.name !== labelConfig.name && labelConfig.name,\n color: existingLabel.color !== labelColor && labelColor,\n description: existingLabel.description !== description && description,\n });\n\n const result = await context.github.issues.updateLabel(\n context.repo({\n current_name: existingLabel.name,\n name: labelConfig.name,\n color: labelColor,\n description,\n }),\n );\n finalLabels[labelKey] = result.data;\n } else {\n finalLabels[labelKey] = existingLabel;\n }\n }\n\n return finalLabels;\n};\n","export const getKeys = (o: T): (keyof T)[] =>\n Object.keys(o) as (keyof T)[];\n","import { WebClient } from '@slack/web-api';\nimport { Context } from 'probot';\nimport { Config } from '../teamconfigs';\nimport { getKeys } from './utils';\n\nexport interface TeamSlack {\n mention: (githubLogin: string) => string;\n postMessage: (githubLogin: string, text: string) => Promise;\n}\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport const initTeamSlack = async (\n context: Context,\n config: Config,\n): Promise => {\n if (!config.slackToken) {\n return {\n mention: (githubLogin: string) => '',\n postMessage: (githubLogin: string, text: string) => Promise.resolve(),\n };\n }\n\n const githubLoginToSlackEmail = getKeys(config.groups).reduce<{\n [login: string]: string;\n }>((acc, groupName) => {\n Object.assign(acc, config.groups[groupName]);\n return acc;\n }, {});\n\n const slackClient = new WebClient(config.slackToken);\n const allUsers: any = await slackClient.users.list({ limit: 200 });\n const members: [string, { member: any; im: any }][] = Object.values(\n githubLoginToSlackEmail,\n )\n .map((email) => {\n const member = allUsers.members.find(\n (user: any) => user.profile.email === email,\n );\n if (!member) {\n console.warn(`Could not find user ${email}`);\n return;\n }\n return [email, { member, im: undefined }] as [\n string,\n { member: any; im: any }\n ];\n })\n .filter(ExcludesFalsy);\n\n for (const [, user] of members) {\n try {\n const im: any = await slackClient.im.open({ user: user.member.id });\n user.im = im.channel;\n } catch (err) {\n console.error(err);\n }\n }\n\n const membersMap = new Map(members);\n\n const getUserFromGithubLogin = (githubLogin: string) => {\n const email = githubLoginToSlackEmail[githubLogin];\n if (!email) return null;\n return membersMap.get(email);\n };\n\n return {\n mention: (githubLogin: string) => {\n const user = getUserFromGithubLogin(githubLogin);\n if (!user) return githubLogin;\n return `<@${user.member.id}>`;\n },\n postMessage: async (githubLogin: string, text: string) => {\n context.log.info('send slack', { githubLogin, text });\n if (process.env.DRY_RUN) return;\n\n const user = getUserFromGithubLogin(githubLogin);\n if (!user || !user.im) return;\n await slackClient.chat.postMessage({\n channel: user.im.id,\n text,\n });\n },\n };\n};\n","import { Context } from 'probot';\nimport { Config } from '../teamconfigs';\nimport { initTeamSlack, TeamSlack } from './initTeamSlack';\nimport { getKeys } from './utils';\n\nexport interface TeamContext {\n config: Config;\n slack: TeamSlack;\n getReviewerGroup: (githubLogin: string) => string | undefined;\n getReviewerGroups: (githubLogins: string[]) => string[];\n reviewShouldWait: (\n reviewerGroup: GroupNames | undefined,\n requestedReviewers: any[],\n {\n includesReviewerGroup,\n includesWaitForGroups,\n }: { includesReviewerGroup?: boolean; includesWaitForGroups?: boolean },\n ) => boolean;\n}\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nconst initTeamContext = async (\n context: Context,\n config: Config,\n): Promise => {\n const slackPromise = initTeamSlack(context, config);\n\n const githubLoginToGroup = getKeys(config.groups).reduce>(\n (acc, groupName) => {\n Object.keys(config.groups[groupName]).forEach((login) => {\n acc.set(login, groupName);\n });\n return acc;\n },\n new Map(),\n );\n\n const getReviewerGroups = (githubLogins: string[]) => [\n ...new Set(\n githubLogins\n .map((githubLogin) => githubLoginToGroup.get(githubLogin))\n .filter(Boolean),\n ),\n ];\n\n return {\n config,\n getReviewerGroup: (githubLogin) => githubLoginToGroup.get(githubLogin),\n getReviewerGroups: (githubLogins) => [\n ...new Set(\n githubLogins\n .map((githubLogin) => githubLoginToGroup.get(githubLogin))\n .filter(ExcludesFalsy),\n ),\n ],\n\n reviewShouldWait: (\n reviewerGroup,\n requestedReviewers,\n { includesReviewerGroup, includesWaitForGroups },\n ) => {\n if (!reviewerGroup) return false;\n\n const requestedReviewerGroups = getReviewerGroups(\n requestedReviewers.map((request) => request.login),\n );\n\n // contains another request of a reviewer in the same group\n if (\n includesReviewerGroup &&\n requestedReviewerGroups.includes(reviewerGroup)\n ) {\n return true;\n }\n\n // contains a request from a dependent group\n if (config.waitForGroups && includesWaitForGroups) {\n const waitForGroups = config.waitForGroups;\n return requestedReviewerGroups.some((group) =>\n waitForGroups[reviewerGroup].includes(group),\n );\n }\n\n return false;\n },\n\n slack: await slackPromise,\n };\n};\n\nconst teamContextsPromise = new Map();\nconst teamContexts = new Map();\n\nexport const obtainTeamContext = (\n context: Context,\n config: Config,\n): Promise => {\n const owner = context.payload.repository.owner;\n\n const existingTeamContext = teamContexts.get(owner.login);\n if (existingTeamContext) return existingTeamContext;\n\n const existingPromise = teamContextsPromise.get(owner.login);\n if (existingPromise) return Promise.resolve(existingPromise);\n\n const promise = initTeamContext(context, config);\n teamContextsPromise.set(owner.login, promise);\n\n return promise.then((teamContext) => {\n teamContextsPromise.delete(owner.login);\n teamContexts.set(owner.login, teamContext);\n return teamContext;\n });\n};\n","/* eslint-disable max-lines */\n\nimport { Lock } from 'lock';\nimport { Context } from 'probot';\nimport { teamConfigs, Config } from '../teamconfigs';\n// eslint-disable-next-line import/no-cycle\nimport { autoMergeIfPossible } from '../pr-handlers/actions/autoMergeIfPossible';\nimport { initRepoLabels, LabelResponse, Labels } from './initRepoLabels';\nimport { obtainTeamContext, TeamContext } from './teamContext';\n\nexport interface LockedMergePr {\n id: number;\n number: number;\n branch: string;\n}\n\ninterface RepoContextWithoutTeamContext {\n labels: Labels;\n protectedLabelIds: readonly LabelResponse['id'][];\n\n hasNeedsReview: (labels: LabelResponse[]) => boolean;\n hasRequestedReview: (labels: LabelResponse[]) => boolean;\n hasChangesRequestedReview: (labels: LabelResponse[]) => boolean;\n hasApprovesReview: (labels: LabelResponse[]) => boolean;\n getNeedsReviewGroupNames: (labels: LabelResponse[]) => GroupNames[];\n\n lockPROrPRS(\n prIdOrIds: string | string[],\n callback: () => Promise | void,\n ): Promise;\n\n getMergeLockedPr(): LockedMergePr;\n addMergeLockPr(pr: LockedMergePr): void;\n removeMergeLockedPr(context: Context, pr: LockedMergePr): void;\n reschedule(context: Context, pr: LockedMergePr): void;\n pushAutomergeQueue(pr: LockedMergePr): void;\n}\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport type RepoContext = TeamContext<\n GroupNames\n> &\n RepoContextWithoutTeamContext;\n\nasync function initRepoContext(\n context: Context,\n config: Config,\n): Promise> {\n const teamContext = await obtainTeamContext(context, config);\n const repoContext = Object.create(teamContext);\n\n const [labels] = await Promise.all([initRepoLabels(context, config)]);\n\n const reviewGroupNames = Object.keys(config.groups) as GroupNames[];\n\n const needsReviewLabelIds = reviewGroupNames\n .map((key: GroupNames) => config.labels.review[key].needsReview)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const requestedReviewLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].requested)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const changesRequestedLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].changesRequested)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const approvedReviewLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].approved)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const protectedLabelIds = [\n ...requestedReviewLabelIds,\n ...changesRequestedLabelIds,\n ...approvedReviewLabelIds,\n ];\n\n const labelIdToGroupName = new Map();\n reviewGroupNames.forEach((key) => {\n const reviewGroupLabels = config.labels.review[key] as any;\n Object.keys(reviewGroupLabels).forEach((labelKey: string) => {\n labelIdToGroupName.set(labels[reviewGroupLabels[labelKey]].id, key);\n });\n });\n\n // const updateStatusCheck = (context, reviewGroup, statusInfo) => {};\n\n const hasNeedsReview = (labels: LabelResponse[]) =>\n labels.some((label) => needsReviewLabelIds.includes(label.id));\n const hasRequestedReview = (labels: LabelResponse[]) =>\n labels.some((label) => requestedReviewLabelIds.includes(label.id));\n const hasChangesRequestedReview = (labels: LabelResponse[]) =>\n labels.some((label) => changesRequestedLabelIds.includes(label.id));\n const hasApprovesReview = (labels: LabelResponse[]) =>\n labels.some((label) => approvedReviewLabelIds.includes(label.id));\n\n const getNeedsReviewGroupNames = (labels: LabelResponse[]): GroupNames[] =>\n labels\n .filter((label) => needsReviewLabelIds.includes(label.id))\n .map((label) => labelIdToGroupName.get(label.id))\n .filter(ExcludesFalsy);\n\n const lock = Lock();\n let lockMergePr: LockedMergePr | undefined;\n const automergeQueue: LockedMergePr[] = [];\n\n const lockPROrPRS = (\n prIdOrIds: string | string[],\n callback: () => Promise | void,\n ): Promise =>\n new Promise((resolve, reject) => {\n console.log('lock: try to lock pr', { prIdOrIds });\n lock(prIdOrIds, async (createReleaseCallback) => {\n const release = createReleaseCallback(() => {});\n console.log('lock: lock acquired', { prIdOrIds });\n try {\n await callback();\n } catch (err) {\n console.log('lock: release pr (with error)', { prIdOrIds });\n release();\n reject(err);\n return;\n }\n console.log('lock: release pr', { prIdOrIds });\n release();\n resolve();\n });\n });\n\n const reschedule = (context: Context, pr: LockedMergePr) => {\n if (!pr) throw new Error('Cannot reschedule undefined');\n context.log.info('reschedule', pr);\n setTimeout(() => {\n lockPROrPRS('reschedule', () => {\n return lockPROrPRS(String(pr.id), async () => {\n const prResult = await context.github.pulls.get(\n context.repo({\n pull_number: pr.number,\n }),\n );\n await autoMergeIfPossible(context, repoContext, prResult.data);\n });\n });\n }, 1000);\n };\n\n return Object.assign(repoContext, {\n labels,\n protectedLabelIds,\n hasNeedsReview,\n hasRequestedReview,\n hasChangesRequestedReview,\n hasApprovesReview,\n getNeedsReviewGroupNames,\n\n getMergeLockedPr: () => lockMergePr,\n addMergeLockPr: (pr: LockedMergePr): void => {\n console.log('merge lock: lock', pr);\n if (lockMergePr && lockMergePr.number === pr.number) return;\n if (lockMergePr) throw new Error('Already have lock');\n lockMergePr = pr;\n },\n removeMergeLockedPr: (context, pr: LockedMergePr): void => {\n console.log('merge lock: remove', pr);\n if (!lockMergePr || lockMergePr.number !== pr.number) return;\n lockMergePr = automergeQueue.shift();\n console.log('merge lock: next', lockMergePr);\n if (lockMergePr) {\n reschedule(context, lockMergePr);\n }\n },\n pushAutomergeQueue: (pr: LockedMergePr): void => {\n console.log('merge lock: push queue', {\n pr,\n lockMergePr,\n automergeQueue,\n });\n if (!automergeQueue.some((p) => p.number === pr.number)) {\n automergeQueue.push(pr);\n }\n },\n reschedule,\n\n lockPROrPRS,\n } as RepoContextWithoutTeamContext);\n}\n\nconst repoContextsPromise = new Map>();\nconst repoContexts = new Map();\n\nexport const obtainRepoContext = (\n context: Context,\n): Promise | RepoContext | null => {\n const repo = context.payload.repository;\n if (\n repo.name === 'reviewflow-test' &&\n process.env.NAME !== 'reviewflow-test'\n ) {\n return null;\n }\n const owner = repo.owner;\n if (!teamConfigs[owner.login]) {\n console.warn(owner.login, Object.keys(teamConfigs));\n return null;\n }\n const key = repo.id;\n\n const existingRepoContext = repoContexts.get(key);\n if (existingRepoContext) return existingRepoContext;\n\n const existingPromise = repoContextsPromise.get(key);\n if (existingPromise) return Promise.resolve(existingPromise);\n\n const promise = initRepoContext(context, teamConfigs[owner.login]);\n repoContextsPromise.set(key, promise);\n\n return promise.then((repoContext) => {\n repoContextsPromise.delete(key);\n repoContexts.set(key, repoContext);\n return repoContext;\n });\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { obtainRepoContext, RepoContext } from '../context/repoContext';\n\nexport type Handler = (\n context: Context,\n repoContext: RepoContext,\n) => Promise;\n\nexport type CallbackWithRepoContext = (\n repoContext: RepoContext,\n) => void | Promise;\n\nexport const handlerPullRequestChange = async <\n T extends Webhooks.WebhookPayloadPullRequest\n>(\n context: Context,\n callback: CallbackWithRepoContext,\n): Promise => {\n const repoContext = await obtainRepoContext(context);\n if (!repoContext) return;\n\n repoContext.lockPROrPRS(String(context.payload.pull_request.id), async () => {\n await callback(repoContext);\n });\n};\n\ntype CallbackContextAndRepoContext = (\n context: Context,\n repoContext: RepoContext,\n) => void | Promise;\n\nexport const createHandlerPullRequestChange = <\n T extends Webhooks.WebhookPayloadPullRequest\n>(\n callback: CallbackContextAndRepoContext,\n) => (context: Context) => {\n return handlerPullRequestChange(context, (repoContext) =>\n callback(context, repoContext),\n );\n};\n\nexport const createHandlerPullRequestsChange = (\n getPullRequests: (\n context: Context,\n repoContext: RepoContext,\n ) => { id: string | number }[],\n callback: CallbackContextAndRepoContext,\n) => async (context: Context): Promise => {\n const repoContext = await obtainRepoContext(context);\n if (!repoContext) return;\n\n const prs = getPullRequests(context, repoContext);\n if (prs.length === 0) return;\n return repoContext.lockPROrPRS(prs.map((pr) => String(pr.id)), () =>\n callback(context, repoContext),\n );\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Handler } from '../utils';\n\nexport const autoAssignPRToCreator: Handler<\n Webhooks.WebhookPayloadPullRequest\n> = async (context, repoContext) => {\n if (!repoContext.config.autoAssignToCreator) return;\n\n const pr = context.payload.pull_request;\n if (pr.assignees.length !== 0) return;\n if (pr.user.type === 'Bot') return;\n\n await context.github.issues.addAssignees(\n context.issue({\n assignees: [pr.user.login],\n }),\n );\n};\n","export const cleanTitle = (title: string): string =>\n title\n .trim()\n .replace(/[\\s-]+\\[?\\s*ONK[- ](\\d+)\\s*]?\\s*$/i, ' ONK-$1')\n .replace(/^([A-Za-z]+)[/:]\\s*/, (s, arg1) => `${arg1.toLowerCase()}: `)\n .replace(/^Revert \"([^\"]+)\"$/, 'revert: $1')\n // eslint-disable-next-line unicorn/no-unsafe-regex\n .replace(/^(revert:.*)(\\s+\\(#\\d+\\))$/, '$1');\n","import { StatusInfo } from '../../../teamconfigs/types';\nimport { parseBody } from './parseBody';\nimport { Options, optionsLabels } from './prOptions';\n\nconst toMarkdownOptions = (options: Record) => {\n return optionsLabels\n .map(\n ({ name, label }) =>\n `- [${options[name] ? 'x' : ' '}] ${label}`,\n )\n .join('\\n');\n};\n\nconst toMarkdownInfos = (infos: StatusInfo[]) => {\n return infos\n .map((info) => {\n if (info.url) return `[${info.title}](${info.url})`;\n return info.title;\n })\n .join('\\n');\n};\n\ninterface UpdatedBodyWithOptions {\n body: string;\n options?: Record;\n}\n\nexport const updateBody = (\n body: string,\n defaultConfig: Record,\n infos?: StatusInfo[],\n updateOptions?: Partial>,\n): UpdatedBodyWithOptions => {\n const parsed = parseBody(body, defaultConfig);\n if (!parsed) {\n console.info('could not parse body');\n return { body };\n }\n const {\n content,\n reviewflowContentCol,\n reviewflowContentColPrefix,\n reviewflowContentColSuffix,\n options,\n } = parsed;\n\n // eslint-disable-next-line no-nested-ternary\n const infosParagraph = !infos\n ? reviewflowContentCol.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^\\s*(?:(#### Infos:.*)?#### Options:)?.*$/s,\n '$1',\n )\n : infos.length !== 0\n ? `#### Infos:\\n${toMarkdownInfos(infos)}\\n`\n : '';\n\n const updatedOptions = !updateOptions\n ? options\n : { ...options, ...updateOptions };\n\n return {\n options: updatedOptions,\n body: `${content}${reviewflowContentColPrefix}\n${infosParagraph}#### Options:\n${toMarkdownOptions(updatedOptions)}\n${reviewflowContentColSuffix}\n`,\n };\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { RepoContext } from '../../context/repoContext';\nimport { StatusError, StatusInfo } from '../../teamconfigs/types';\nimport { cleanTitle } from './utils/cleanTitle';\nimport { updateBody } from './utils/updateBody';\n\ninterface StatusWithInfo {\n name: string;\n info: StatusInfo;\n error?: undefined;\n}\n\ninterface StatusWithError {\n name: string;\n error: StatusError;\n info?: undefined;\n}\n\ntype Status = StatusWithInfo | StatusWithError;\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport const editOpenedPR = async (\n context: Context,\n repoContext: RepoContext,\n): Promise => {\n const repo = context.payload.repository;\n const pr = context.payload.pull_request;\n\n // do not lint pr from forks\n if (pr.head.repo.id !== repo.id) return;\n\n const title = repoContext.config.trimTitle ? cleanTitle(pr.title) : pr.title;\n\n const isPrFromBot = pr.user.type === 'Bot';\n\n const statuses: Status[] = [];\n\n const errorRule = repoContext.config.parsePR.title.find((rule) => {\n if (rule.bot === false && isPrFromBot) return false;\n\n const match = rule.regExp.exec(pr.title);\n if (match === null) {\n if (rule.status) {\n statuses.push({ name: rule.status, error: rule.error });\n }\n return true;\n }\n\n if (rule.status && rule.statusInfoFromMatch) {\n statuses.push({\n name: rule.status,\n info: rule.statusInfoFromMatch(match),\n });\n return false;\n }\n\n return false;\n });\n\n const date = new Date().toISOString();\n\n const hasLintPrCheck = (await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n }),\n )).data.check_runs.find(\n (check) => check.name === `${process.env.NAME}/lint-pr`,\n );\n\n await Promise.all(\n [\n ...statuses.map(({ name, error, info }) =>\n context.github.repos.createStatus(\n context.repo({\n context: `${process.env.NAME}/${name}`,\n sha: pr.head.sha,\n state: (error ? 'failure' : 'success') as 'failure' | 'success',\n target_url: error ? undefined : (info as StatusInfo).url,\n description: error ? error.title : (info as StatusInfo).title,\n }),\n ),\n ),\n hasLintPrCheck &&\n context.github.checks.create(\n context.repo({\n name: `${process.env.NAME}/lint-pr`,\n head_sha: pr.head.sha,\n status: 'completed' as 'completed',\n conclusion: (errorRule ? 'failure' : 'success') as\n | 'failure'\n | 'success',\n started_at: date,\n completed_at: date,\n output: errorRule\n ? errorRule.error\n : {\n title: '✓ Your PR is valid',\n summary: '',\n },\n }),\n ),\n !hasLintPrCheck &&\n context.github.repos.createStatus(\n context.repo({\n context: `${process.env.NAME}/lint-pr`,\n sha: pr.head.sha,\n state: (errorRule ? 'failure' : 'success') as 'failure' | 'success',\n target_url: undefined,\n description: errorRule\n ? errorRule.error.title\n : '✓ Your PR is valid',\n }),\n ),\n ].filter(ExcludesFalsy),\n );\n\n const featureBranchLabel = repoContext.labels['feature-branch'];\n const prHasFeatureBranchLabel = Boolean(\n featureBranchLabel &&\n pr.labels.find((label): boolean => label.id === featureBranchLabel.id),\n );\n const defaultOptions = {\n ...repoContext.config.prDefaultOptions,\n featureBranch: prHasFeatureBranchLabel,\n };\n\n const { body, options } = updateBody(pr.body, defaultOptions, statuses\n .filter((status) => status.info && status.info.inBody)\n .map((status) => status.info) as StatusInfo[]);\n\n const hasDiffInTitle = pr.title !== title;\n const hasDiffInBody = pr.body !== body;\n if (hasDiffInTitle || hasDiffInBody) {\n const update: Partial> = {};\n if (hasDiffInTitle) {\n update.title = title;\n pr.title = title;\n }\n if (hasDiffInBody) {\n update.body = body;\n pr.body = body;\n }\n\n await context.github.issues.update(context.issue(update));\n }\n\n if (options && featureBranchLabel) {\n if (prHasFeatureBranchLabel && !options.featureBranch) {\n await context.github.issues.removeLabel(\n context.issue({ name: featureBranchLabel.name }),\n );\n }\n\n if (options.featureBranch && !prHasFeatureBranchLabel) {\n await context.github.issues.addLabels(\n context.issue({ labels: [featureBranchLabel.name] }),\n );\n }\n }\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { RepoContext } from '../../context/repoContext';\n\nconst addStatusCheck = async function<\n E extends Webhooks.WebhookPayloadPullRequest\n>(\n context: Context,\n pr: any,\n { state, description }: { state: 'failure' | 'success'; description: string },\n): Promise {\n const hasPrCheck = (await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n }),\n )).data.check_runs.find((check) => check.name === process.env.NAME);\n\n context.log.info('add status check', { hasPrCheck, state, description });\n\n if (hasPrCheck) {\n await context.github.checks.create(\n context.repo({\n name: process.env.NAME as string,\n head_sha: pr.head.sha,\n started_at: pr.created_at,\n status: 'completed',\n conclusion: state,\n completed_at: new Date().toISOString(),\n output: {\n title: description,\n summary: '',\n },\n }),\n );\n } else {\n await context.github.repos.createStatus(\n context.repo({\n context: process.env.NAME,\n sha: pr.head.sha,\n state,\n target_url: undefined,\n description,\n }),\n );\n }\n};\n\nconst createFailedStatusCheck = (\n context: Context,\n pr: any,\n description: string,\n): Promise =>\n addStatusCheck(context, pr, {\n state: 'failure',\n description,\n });\n\nexport const updateStatusCheckFromLabels = (\n context: Context,\n repoContext: RepoContext,\n pr: any = context.payload.pull_request,\n labels: LabelResponse[] = pr.labels || [],\n): Promise => {\n context.log.info('updateStatusCheckFromLabels', {\n labels: labels.map((l) => l && l.name),\n hasNeedsReview: repoContext.hasNeedsReview(labels),\n hasApprovesReview: repoContext.hasApprovesReview(labels),\n });\n\n if (pr.requested_reviewers.length !== 0) {\n return createFailedStatusCheck(\n context,\n pr,\n `Awaiting review from: ${pr.requested_reviewers\n .map((rr: any) => rr.login)\n .join(', ')}`,\n );\n }\n\n if (repoContext.hasChangesRequestedReview(labels)) {\n return createFailedStatusCheck(\n context,\n pr,\n 'Changes requested ! Push commits or discuss changes then re-request a review.',\n );\n }\n\n const needsReviewGroupNames = repoContext.getNeedsReviewGroupNames(labels);\n\n if (needsReviewGroupNames.length !== 0) {\n return createFailedStatusCheck(\n context,\n pr,\n `Awaiting review from: ${needsReviewGroupNames.join(\n ', ',\n )}. Perhaps request someone ?`,\n );\n }\n\n if (!repoContext.hasApprovesReview(labels)) {\n if (\n repoContext.config.requiresReviewRequest &&\n !pr.head.ref.startsWith('renovate/')\n ) {\n return createFailedStatusCheck(\n context,\n pr,\n 'Awaiting review... Perhaps request someone ?',\n );\n }\n }\n\n // if (\n // repoContext.config.requiresReviewRequest &&\n // !repoContext.hasRequestedReview(labels)\n // ) {\n // return createFailedStatusCheck(\n // context,\n // pr,\n // 'You need to request someone to review the PR',\n // );\n // return;\n // }\n // return createInProgressStatusCheck(context);\n // } else if (repoContext.hasApprovesReview(labels)) {\n return addStatusCheck(context, pr, {\n state: 'success',\n description: '✓ PR ready to merge !',\n });\n // }\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { GroupLabels } from '../../teamconfigs/types';\nimport { RepoContext } from '../../context/repoContext';\nimport { updateStatusCheckFromLabels } from './updateStatusCheckFromLabels';\n\nexport const updateReviewStatus = async <\n E extends Webhooks.WebhookPayloadPullRequest,\n GroupNames extends string = any\n>(\n context: Context,\n repoContext: RepoContext,\n reviewGroup: GroupNames,\n {\n add: labelsToAdd,\n remove: labelsToRemove,\n }: {\n add?: (GroupLabels | false | undefined)[];\n remove?: (GroupLabels | false | undefined)[];\n },\n): Promise => {\n context.log.info('updateReviewStatus', {\n reviewGroup,\n labelsToAdd,\n labelsToRemove,\n });\n\n const pr = context.payload.pull_request;\n let prLabels = pr.labels || [];\n if (!reviewGroup) return prLabels;\n\n const newLabelNames = new Set(\n prLabels.map((label: LabelResponse) => label.name),\n );\n\n const toAdd = new Set();\n const toDelete = new Set();\n const labels = repoContext.labels;\n\n const getLabelFromKey = (key: GroupLabels): undefined | LabelResponse => {\n const reviewConfig = repoContext.config.labels.review[reviewGroup];\n if (!reviewConfig) return undefined;\n\n return reviewConfig[key] && labels[reviewConfig[key]]\n ? labels[reviewConfig[key]]\n : undefined;\n };\n\n if (labelsToAdd) {\n labelsToAdd.forEach((key) => {\n if (!key) return;\n const label = getLabelFromKey(key);\n if (\n !label ||\n prLabels.some((prLabel: LabelResponse) => prLabel.id === label.id)\n ) {\n return;\n }\n newLabelNames.add(label.name);\n toAdd.add(key);\n });\n }\n\n if (labelsToRemove) {\n labelsToRemove.forEach((key) => {\n if (!key) return;\n const label = getLabelFromKey(key);\n if (!label) return;\n const existing = prLabels.find(\n (prLabel: LabelResponse) => prLabel.id === label.id,\n );\n if (existing) {\n newLabelNames.delete(existing.name);\n toDelete.add(key);\n }\n });\n }\n\n const newLabelNamesArray = [...newLabelNames];\n\n context.log.info('updateReviewStatus', {\n reviewGroup,\n toAdd: [...toAdd],\n toDelete: [...toDelete],\n oldLabels: prLabels.map((l: LabelResponse) => l.name),\n newLabelNames: newLabelNamesArray,\n });\n\n // if (process.env.DRY_RUN) return;\n\n if (toAdd.size || toDelete.size) {\n const result = await context.github.issues.replaceLabels(\n context.issue({\n labels: newLabelNamesArray,\n }),\n );\n prLabels = result.data;\n }\n\n // if (toAdd.has('needsReview')) {\n // createInProgressStatusCheck(context);\n // } else if (\n // toDelete.has('needsReview') ||\n // (prLabels.length === 0 && toAdd.size === 1 && toAdd.has('approved'))\n // ) {\n await updateStatusCheckFromLabels(context, repoContext, pr, prLabels);\n // }\n\n return prLabels;\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { RepoContext } from '../../context/repoContext';\nimport { autoMergeIfPossible } from './autoMergeIfPossible';\n\nexport const autoApproveAndAutoMerge = async (\n context: Context,\n repoContext: RepoContext,\n): Promise => {\n // const autoMergeLabel = repoContext.labels['merge/automerge'];\n const codeApprovedLabel = repoContext.labels['code/approved'];\n const prLabels = context.payload.pull_request.labels;\n if (prLabels.find((l): boolean => l.id === codeApprovedLabel.id)) {\n await context.github.pulls.createReview(\n context.issue({ event: 'APPROVE' }),\n );\n }\n\n await autoMergeIfPossible(context, repoContext);\n};\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoAssignPRToCreator } from './actions/autoAssignPRToCreator';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\nimport { autoApproveAndAutoMerge } from './actions/autoApproveAndAutoMerge';\n\nexport default function opened(app: Application): void {\n app.on(\n 'pull_request.opened',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const fromRenovate = context.payload.pull_request.head.ref.startsWith(\n 'renovate/',\n );\n\n await Promise.all([\n autoAssignPRToCreator(context, repoContext),\n editOpenedPR(context, repoContext),\n fromRenovate\n ? autoApproveAndAutoMerge(context, repoContext)\n : updateReviewStatus(context, repoContext, 'dev', {\n add: ['needsReview'],\n remove: ['approved', 'changesRequested'],\n }),\n ]);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\nimport { parseBody } from './actions/utils/parseBody';\n\nexport default function closed(app: Application): void {\n app.on(\n 'pull_request.closed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const repo = context.payload.repository;\n const pr = context.payload.pull_request;\n\n if (pr.merged) {\n const parsedBody =\n pr.head.repo.id === repo.id &&\n parseBody(pr.body, repoContext.config.prDefaultOptions);\n const createMergeLockPrFromPr = () => ({\n id: pr.id,\n number: pr.number,\n branch: pr.head.ref,\n });\n await Promise.all([\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr()),\n parsedBody && parsedBody.options.deleteAfterMerge\n ? context.github.git\n .deleteRef(context.repo({ ref: `heads/${pr.head.ref}` }))\n .catch(() => {})\n : undefined,\n ]);\n } else {\n await Promise.all([\n updateReviewStatus(context, repoContext, 'dev', {\n remove: ['needsReview'],\n }),\n ]);\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewRequested(app: Application): void {\n app.on(\n 'pull_request.review_requested',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n\n // ignore if sender is self (dismissed review rerequest review)\n if (sender.type === 'Bot') return;\n\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).requested_reviewer;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n const shouldWait = false;\n // repoContext.reviewShouldWait(reviewerGroup, pr.requested_reviewers, { includesWaitForGroups: true });\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup &&\n review.state === 'REQUEST_CHANGES' &&\n // In case this is a rerequest for review\n review.user.login !== reviewer.login,\n );\n\n if (!hasChangesRequestedInReviews) {\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: ['needsReview', !shouldWait && 'requested'],\n remove: ['approved', 'changesRequested'],\n });\n }\n }\n\n if (sender.login === reviewer.login) return;\n\n if (!shouldWait && repoContext.slack) {\n repoContext.slack.postMessage(\n reviewer.login,\n `:eyes: ${repoContext.slack.mention(\n sender.login,\n )} requests your review on ${pr.html_url} !\\n> ${pr.title}`,\n );\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewRequestRemoved(app: Application): void {\n app.on(\n 'pull_request.review_request_removed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).requested_reviewer;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const hasRequestedReviewsForGroup = repoContext.reviewShouldWait(\n reviewerGroup,\n pr.requested_reviewers,\n {\n includesReviewerGroup: true,\n },\n );\n\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n const hasApprovedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'APPROVED',\n );\n\n const approved =\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n hasApprovedInReviews;\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: [\n // if changes requested by the one which requests was removed\n hasChangesRequestedInReviews && 'changesRequested',\n // if was already approved by another member in the group and has no other requests waiting\n approved && 'approved',\n ],\n // remove labels if has no other requests waiting\n remove: [\n approved && 'needsReview',\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n 'requested',\n ],\n });\n }\n\n if (sender.login === reviewer.login) return;\n\n if (repoContext.slack) {\n repoContext.slack.postMessage(\n reviewer.login,\n `:skull_and_crossbones: ${repoContext.slack.mention(\n sender.login,\n )} removed the request for your review on ${pr.html_url}`,\n );\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewSubmitted(app: Application): void {\n app.on(\n 'pull_request_review.submitted',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const pr = context.payload.pull_request;\n const { user: reviewer, state } = (context.payload as any).review;\n if (pr.user.login === reviewer.login) return;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n let merged;\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const hasRequestedReviewsForGroup = repoContext.reviewShouldWait(\n reviewerGroup,\n pr.requested_reviewers,\n {\n includesReviewerGroup: true,\n // TODO reenable this when accepted can notify request review to slack (dev accepted => design requested) and flag to disable for label (approved design ; still waiting for dev ?)\n // includesWaitForGroups: true,\n },\n );\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n const approved =\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n state === 'approved';\n\n const newLabels = await updateReviewStatus(\n context,\n repoContext,\n reviewerGroup,\n {\n add: [\n approved && 'approved',\n state === 'changes_requested' && 'changesRequested',\n ],\n remove: [\n approved && 'needsReview',\n !(\n hasRequestedReviewsForGroup || state === 'changes_requested'\n ) && 'requested',\n state === 'approved' &&\n !hasChangesRequestedInReviews &&\n 'changesRequested',\n state === 'changes_requested' && 'approved',\n ],\n },\n );\n\n if (approved && !hasChangesRequestedInReviews) {\n merged = await autoMergeIfPossible(\n context,\n repoContext,\n pr,\n newLabels,\n );\n }\n }\n\n const mention = repoContext.slack.mention(reviewer.login);\n const prUrl = pr.html_url;\n\n const message = (() => {\n if (state === 'changes_requested') {\n return `:x: ${mention} requests changes on ${prUrl}`;\n }\n if (state === 'approved') {\n return `:clap: :white_check_mark: ${mention} approves ${prUrl}${\n merged ? ' and PR is merged :tada:' : ''\n }`;\n }\n return `:speech_balloon: ${mention} commented on ${prUrl}`;\n })();\n\n repoContext.slack.postMessage(pr.user.login, message);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewDismissed(app: Application): void {\n app.on(\n 'pull_request_review.dismissed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).review.user;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: ['needsReview', 'requested'],\n remove: [\n !hasChangesRequestedInReviews && 'changesRequested',\n 'approved',\n ],\n });\n }\n\n if (repoContext.slack) {\n if (sender.login === reviewer.login) {\n repoContext.slack.postMessage(\n pr.user.login,\n `:skull: ${repoContext.slack.mention(\n reviewer.login,\n )} dismissed his review on ${pr.html_url}`,\n );\n } else {\n repoContext.slack.postMessage(\n reviewer.login,\n `:skull: ${repoContext.slack.mention(\n sender.login,\n )} dismissed your review on ${pr.html_url}`,\n );\n }\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { updateStatusCheckFromLabels } from './actions/updateStatusCheckFromLabels';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function synchronize(app: Application): void {\n app.on(\n 'pull_request.synchronize',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n // old and new sha\n // const { before, after } = context.payload;\n\n await Promise.all([\n editOpenedPR(context, repoContext),\n // addStatusCheckToLatestCommit\n updateStatusCheckFromLabels(context, repoContext),\n // call autoMergeIfPossible to re-add to the queue when push is fixed\n autoMergeIfPossible(context, repoContext),\n ]);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function edited(app: Application): void {\n app.on(\n 'pull_request.edited',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n await editOpenedPR(context, repoContext);\n\n await autoMergeIfPossible(context, repoContext);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { handlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\nimport { updateStatusCheckFromLabels } from './actions/updateStatusCheckFromLabels';\nimport { autoApproveAndAutoMerge } from './actions/autoApproveAndAutoMerge';\nimport { updateBody } from './actions/utils/updateBody';\n\nexport default function labelsChanged(app: Application): void {\n app.on(\n ['pull_request.labeled', 'pull_request.unlabeled'],\n async (context) => {\n const sender = context.payload.sender;\n const fromRenovate =\n sender.type === 'Bot' &&\n context.payload.pull_request.head.ref.startsWith('renovate/');\n\n if (sender.type === 'Bot' && !fromRenovate) {\n return;\n }\n\n await handlerPullRequestChange(context, async (repoContext) => {\n if (fromRenovate) {\n return autoApproveAndAutoMerge(context, repoContext);\n }\n\n const label = context.payload.label;\n if (repoContext.protectedLabelIds.includes(label.id)) {\n if (context.payload.action === 'labeled') {\n await context.github.issues.removeLabel(\n context.issue({ name: label.name }),\n );\n } else {\n await context.github.issues.addLabels(\n context.issue({ labels: [label.name] }),\n );\n }\n return;\n }\n\n await updateStatusCheckFromLabels(context, repoContext);\n\n if (\n repoContext.labels['feature-branch'] &&\n label.id === repoContext.labels['feature-branch'].id\n ) {\n const prBody = context.payload.pull_request.body;\n const { body } = updateBody(\n prBody,\n {\n featureBranch: false,\n deleteAfterMerge: false,\n },\n undefined,\n {\n featureBranch: context.payload.action === 'labeled',\n },\n );\n\n if (body !== prBody) {\n await context.github.pulls.update(context.issue({ body }));\n }\n } else if (context.payload.action === 'labeled') {\n if (\n repoContext.labels['merge/automerge'] &&\n label.id === repoContext.labels['merge/automerge'].id\n ) {\n await autoMergeIfPossible(context, repoContext);\n }\n }\n });\n },\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestsChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function checkrunCompleted(app: Application): void {\n app.on(\n 'check_run.completed',\n createHandlerPullRequestsChange(\n (context) => context.payload.check_run.pull_requests,\n async (context, repoContext) => {\n await Promise.all(\n context.payload.check_run.pull_requests.map((pr) =>\n context.github.pulls\n .get(\n context.repo({\n number: pr.number,\n }),\n )\n .then((prResult) => {\n return autoMergeIfPossible(context, repoContext, prResult.data);\n }),\n ),\n );\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestsChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function checksuiteCompleted(app: Application): void {\n app.on(\n 'check_suite.completed',\n createHandlerPullRequestsChange(\n (context) => context.payload.check_suite.pull_requests,\n async (context, repoContext) => {\n await Promise.all(\n context.payload.check_suite.pull_requests.map((pr) =>\n context.github.pulls\n .get(\n context.repo({\n number: pr.number,\n }),\n )\n .then((prResult) => {\n return autoMergeIfPossible(context, repoContext, prResult.data);\n }),\n ),\n );\n },\n ),\n );\n}\n","import Webhooks from '@octokit/webhooks';\nimport { Application, Context } from 'probot';\nimport { LockedMergePr } from '../context/repoContext';\nimport { createHandlerPullRequestsChange } from './utils';\n\nconst isSameBranch = (\n context: Context,\n lockedPr: LockedMergePr,\n): boolean => {\n if (!lockedPr) return false;\n return !!context.payload.branches.find((b) => b.name === lockedPr.branch);\n};\n\nexport default function status(app: Application): void {\n app.on(\n 'status',\n createHandlerPullRequestsChange(\n (context, repoContext): LockedMergePr[] => {\n const lockedPr = repoContext.getMergeLockedPr();\n if (!lockedPr) return [];\n\n if (isSameBranch(context, lockedPr)) {\n return [lockedPr];\n }\n\n return [];\n },\n (context, repoContext): void => {\n const lockedPr = repoContext.getMergeLockedPr();\n // check if changed\n if (isSameBranch(context, lockedPr)) {\n repoContext.reschedule(context, lockedPr);\n }\n },\n ),\n );\n}\n","import 'dotenv/config';\nimport { Probot, Application } from 'probot';\nimport openedHandler from './pr-handlers/opened';\nimport closedHandler from './pr-handlers/closed';\nimport reviewRequestedHandler from './pr-handlers/reviewRequested';\nimport reviewRequestRemovedHandler from './pr-handlers/reviewRequestRemoved';\nimport reviewSubmittedHandler from './pr-handlers/reviewSubmitted';\nimport reviewDismissedHandler from './pr-handlers/reviewDismissed';\nimport synchromizeHandler from './pr-handlers/synchronize';\nimport editedHandler from './pr-handlers/edited';\nimport labelsChanged from './pr-handlers/labelsChanged';\nimport checkrunCompleted from './pr-handlers/checkrunCompleted';\nimport checksuiteCompleted from './pr-handlers/checksuiteCompleted';\nimport status from './pr-handlers/status';\n\nif (!process.env.NAME) process.env.NAME = 'reviewflow';\n\n// const getConfig = require('probot-config')\n// const { MongoClient } = require('mongodb');\n\n// const connect = MongoClient.connect(process.env.MONGO_URL);\n// const db = connect.then(client => client.db(process.env.MONGO_DB));\n\n// let config = await getConfig(context, 'reviewflow.yml');\n\n// eslint-disable-next-line import/no-commonjs\nProbot.run((app: Application) => {\n openedHandler(app);\n closedHandler(app);\n reviewRequestedHandler(app);\n reviewRequestRemovedHandler(app);\n\n // app.on('pull_request.closed', async context => {\n\n // });\n\n // app.on('pull_request.reopened', async context => {\n\n // });\n\n reviewSubmittedHandler(app);\n reviewDismissedHandler(app);\n labelsChanged(app);\n synchromizeHandler(app);\n editedHandler(app);\n\n checkrunCompleted(app);\n checksuiteCompleted(app);\n status(app);\n});\n"],"names":["config","slackToken","process","env","ORNIKAR_SLACK_TOKEN","autoAssignToCreator","trimTitle","requiresReviewRequest","prDefaultOptions","featureBranch","deleteAfterMerge","parsePR","title","regExp","error","summary","bot","status","statusInfoFromMatch","match","issue","inBody","url","groups","dev","abarreir","ORNIKAR_EMAIL_DOMAIN","arthurflachs","CorentinAndre","rigma","damienorny","darame07","Pixy","christophehurpeau","HugoGarrido","LentnerStefan","Mxime","tilap","design","jperriere","CoralineColasse","waitForGroups","labels","list","name","color","review","ci","inProgress","succeeded","failed","needsReview","requested","changesRequested","approved","teamConfigs","ornikar","options","optionsRegexps","map","option","regexp","RegExp","optionsLabels","label","commentStart","commentEnd","regexpCols","regexpReviewflowCol","parseOptions","content","defaultConfig","reduce","acc","exec","parseBody","description","reviewFlowCol","reviewflowContent","reviewFlowColMatch","reviewflowContentCol","reviewflowContentColPrefix","reviewflowContentColSuffix","hasFailedStatusOrChecks","context","repoContext","pr","checks","github","listForRef","repo","ref","head","sha","per_page","failedChecks","data","check_runs","filter","check","conclusion","length","log","info","id","combinedStatus","repos","getCombinedStatusForRef","state","failedStatuses","statuses","autoMergeIfPossible","payload","pull_request","prLabels","autoMergeLabel","createMergeLockPrFromPr","number","branch","find","l","debug","removeMergeLockedPr","hasNeedsReview","hasRequestedReview","lockedPr","getMergeLockedPr","pushAutomergeQueue","addMergeLockPr","mergeable","undefined","prResult","pulls","get","pull_number","merged","mergeable_state","reschedule","startsWith","issues","update","body","replace","base","merge","owner","login","parsedBody","mergeResult","merge_method","commit_title","commit_message","Boolean","err","message","initRepoLabels","listLabelsForRepo","finalLabels","labelKey","labelConfig","Object","entries","labelColor","slice","existingLabel","result","createLabel","current_name","updateLabel","getKeys","o","keys","ExcludesFalsy","initTeamSlack","mention","postMessage","Promise","resolve","githubLoginToSlackEmail","groupName","assign","slackClient","WebClient","allUsers","users","limit","members","values","email","member","user","profile","console","warn","im","open","channel","membersMap","Map","getUserFromGithubLogin","githubLogin","text","DRY_RUN","chat","initTeamContext","slackPromise","githubLoginToGroup","forEach","set","getReviewerGroups","githubLogins","Set","getReviewerGroup","reviewShouldWait","reviewerGroup","requestedReviewers","includesReviewerGroup","includesWaitForGroups","requestedReviewerGroups","request","includes","some","group","slack","teamContextsPromise","teamContexts","obtainTeamContext","repository","existingTeamContext","existingPromise","promise","then","teamContext","delete","initRepoContext","create","all","reviewGroupNames","needsReviewLabelIds","key","requestedReviewLabelIds","changesRequestedLabelIds","approvedReviewLabelIds","protectedLabelIds","labelIdToGroupName","reviewGroupLabels","lock","Lock","lockMergePr","automergeQueue","lockPROrPRS","prIdOrIds","callback","reject","createReleaseCallback","release","Error","setTimeout","String","hasChangesRequestedReview","hasApprovesReview","getNeedsReviewGroupNames","shift","p","push","repoContextsPromise","repoContexts","obtainRepoContext","NAME","existingRepoContext","handlerPullRequestChange","createHandlerPullRequestChange","createHandlerPullRequestsChange","getPullRequests","prs","autoAssignPRToCreator","assignees","type","addAssignees","cleanTitle","trim","s","arg1","toLowerCase","toMarkdownOptions","join","toMarkdownInfos","infos","updateBody","updateOptions","parsed","infosParagraph","updatedOptions","editOpenedPR","isPrFromBot","errorRule","rule","date","Date","toISOString","hasLintPrCheck","createStatus","target_url","head_sha","started_at","completed_at","output","featureBranchLabel","prHasFeatureBranchLabel","defaultOptions","hasDiffInTitle","hasDiffInBody","removeLabel","addLabels","addStatusCheck","hasPrCheck","created_at","createFailedStatusCheck","updateStatusCheckFromLabels","requested_reviewers","rr","needsReviewGroupNames","updateReviewStatus","reviewGroup","add","labelsToAdd","remove","labelsToRemove","newLabelNames","toAdd","toDelete","getLabelFromKey","reviewConfig","prLabel","existing","newLabelNamesArray","oldLabels","size","replaceLabels","autoApproveAndAutoMerge","codeApprovedLabel","createReview","event","opened","app","on","fromRenovate","closed","git","deleteRef","catch","reviewRequested","sender","reviewer","requested_reviewer","reviews","listReviews","hasChangesRequestedInReviews","html_url","reviewRequestRemoved","hasRequestedReviewsForGroup","hasApprovedInReviews","reviewSubmitted","newLabels","prUrl","reviewDismissed","synchronize","edited","labelsChanged","action","prBody","checkrunCompleted","check_run","pull_requests","checksuiteCompleted","check_suite","isSameBranch","branches","b","Probot","run","openedHandler","closedHandler","reviewRequestedHandler","reviewRequestRemovedHandler","reviewSubmittedHandler","reviewDismissedHandler","synchromizeHandler","editedHandler"],"mappings":";;;;;;;AAEA,MAAMA,MAAgC,GAAG;EACvCC,UAAU,EAAEC,OAAO,CAACC,GAAR,CAAYC,mBADe;EAEvCC,mBAAmB,EAAE,IAFkB;EAGvCC,SAAS,EAAE,IAH4B;EAIvCC,qBAAqB,EAAE,IAJgB;EAKvCC,gBAAgB,EAAE;IAChBC,aAAa,EAAE,KADC;IAEhBC,gBAAgB,EAAE;GAPmB;EASvCC,OAAO,EAAE;IACPC,KAAK,EAAE,CACL;MACEC,MAAM;gGADR;MAIEC,KAAK,EAAE;QACLF,KAAK,EAAE,8CADF;QAELG,OAAO,EACL;;KARD,EAWL;MACEC,GAAG,EAAE,KADP;MAEEH,MAAM,EAAE,4BAFV;MAGEC,KAAK,EAAE;QACLF,KAAK,EAAE,gCADF;QAELG,OAAO,EAAE;OALb;MAOEE,MAAM,EAAE,YAPV;MAQEC,mBAAmB,EAAGC,KAAD,IAAW;cACxBC,KAAK,GAAGD,KAAK,CAAC,CAAD,CAAnB;;YACIC,KAAK,KAAK,YAAd,EAA4B;iBACnB;YACLR,KAAK,EAAE,UADF;YAELG,OAAO,EAAE;WAFX;;;eAKK;UACLM,MAAM,EAAE,IADH;UAELC,GAAG,EAAG,wCAAuCF,KAAM,EAF9C;UAGLR,KAAK,EAAG,eAAcQ,KAAM,EAHvB;UAILL,OAAO,EAAG,IAAGK,KAAM,0CAAyCA,KAAM;SAJpE;;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AACA,QAAD,CAAP;;;WAGK,EAAP;GAT2B,EAW7B,CAACzC,OAAD,EAAUC,WAAV,KAAgC;UACxBwC,QAAQ,GAAGxC,WAAW,CAACyC,gBAAZ,EAAjB,CAD8B;;QAG1B0P,YAAY,CAACpS,OAAD,EAAUyC,QAAV,CAAhB,EAAqC;MACnCxC,WAAW,CAACoD,UAAZ,CAAuBrD,OAAvB,EAAgCyC,QAAhC;;GAfyB,CAFjC;;;ACCF,IAAI,CAAC3H,OAAO,CAACC,GAAR,CAAYyQ,IAAjB,EAAuB1Q,OAAO,CAACC,GAAR,CAAYyQ,IAAZ,GAAmB,YAAnB;;;;;;;AAWvB+G,aAAM,CAACC,GAAP,CAAYpC,GAAD,IAAsB;EAC/BqC,MAAa,CAACrC,GAAD,CAAb;EACAsC,MAAa,CAACtC,GAAD,CAAb;EACAuC,eAAsB,CAACvC,GAAD,CAAtB;EACAwC,oBAA2B,CAACxC,GAAD,CAA3B,CAJ+B;;;;;EAc/ByC,eAAsB,CAACzC,GAAD,CAAtB;EACA0C,eAAsB,CAAC1C,GAAD,CAAtB;EACAwB,aAAa,CAACxB,GAAD,CAAb;EACA2C,WAAkB,CAAC3C,GAAD,CAAlB;EACA4C,MAAa,CAAC5C,GAAD,CAAb;EAEA2B,iBAAiB,CAAC3B,GAAD,CAAjB;EACA8B,mBAAmB,CAAC9B,GAAD,CAAnB;EACAvU,MAAM,CAACuU,GAAD,CAAN;CAtBF"} \ No newline at end of file +{"version":3,"file":"index-node10-dev.cjs.js","sources":["../src/teamconfigs/ornikar.ts","../src/teamconfigs/christophehurpeau.ts","../src/teamconfigs/index.ts","../src/pr-handlers/actions/utils/prOptions.ts","../src/pr-handlers/actions/utils/parseBody.ts","../src/pr-handlers/actions/autoMergeIfPossible.ts","../src/context/initRepoLabels.ts","../src/context/utils.ts","../src/context/initTeamSlack.ts","../src/context/teamContext.ts","../src/context/repoContext.ts","../src/pr-handlers/utils.ts","../src/pr-handlers/actions/autoAssignPRToCreator.ts","../src/pr-handlers/actions/utils/cleanTitle.ts","../src/pr-handlers/actions/utils/updateBody.ts","../src/pr-handlers/actions/editOpenedPR.ts","../src/pr-handlers/actions/updateStatusCheckFromLabels.ts","../src/pr-handlers/actions/updateReviewStatus.ts","../src/pr-handlers/actions/autoApproveAndAutoMerge.ts","../src/pr-handlers/opened.ts","../src/pr-handlers/closed.ts","../src/pr-handlers/reviewRequested.ts","../src/pr-handlers/reviewRequestRemoved.ts","../src/pr-handlers/reviewSubmitted.ts","../src/pr-handlers/reviewDismissed.ts","../src/pr-handlers/synchronize.ts","../src/pr-handlers/edited.ts","../src/pr-handlers/labelsChanged.ts","../src/pr-handlers/checkrunCompleted.ts","../src/pr-handlers/checksuiteCompleted.ts","../src/pr-handlers/status.ts","../src/index.ts"],"sourcesContent":["import { Config } from './types';\n\nconst config: Config<'dev' | 'design'> = {\n slackToken: process.env.ORNIKAR_SLACK_TOKEN,\n autoAssignToCreator: true,\n trimTitle: true,\n requiresReviewRequest: true,\n prDefaultOptions: {\n featureBranch: false,\n autoMerge: false,\n deleteAfterMerge: true,\n },\n parsePR: {\n title: [\n {\n regExp:\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^(revert: )?(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\\(([a-z\\-/]*)\\))?:\\s/,\n error: {\n title: 'Title does not match commitlint conventional',\n summary:\n 'https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional',\n },\n },\n {\n bot: false,\n regExp: /\\s(ONK-(\\d+)|\\[no issue])$/,\n error: {\n title: 'Title does not have JIRA issue',\n summary: 'The PR title should end with ONK-0000, or [no issue]',\n },\n status: 'jira-issue',\n statusInfoFromMatch: (match) => {\n const issue = match[1];\n if (issue === '[no issue]') {\n return {\n title: 'No issue',\n summary: '',\n };\n }\n return {\n inBody: true,\n url: `https://ornikar.atlassian.net/browse/${issue}`,\n title: `JIRA issue: ${issue}`,\n summary: `[${issue}](https://ornikar.atlassian.net/browse/${issue})`,\n };\n },\n },\n ],\n },\n\n groups: {\n dev: {\n /* back */\n abarreir: `alexandre${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n arthurflachs: `arthur${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n CorentinAndre: `corentin${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n rigma: `romain${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n damienorny: `damien.orny${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n 'Thierry-girod': `thierry${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n darame07: `kevin${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n Pixy: `pierre-alexis${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n /* front */\n christophehurpeau: `christophe${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n HugoGarrido: `hugo${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n LentnerStefan: `stefan${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n Mxime: `maxime${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n tilap: `julien.lavinh${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n '63m29': `valerian${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n },\n design: {\n jperriere: `julien${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n CoralineColasse: `coraline${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n },\n },\n waitForGroups: {\n dev: [],\n design: ['dev'],\n },\n labels: {\n list: {\n // /* ci */\n // 'ci/in-progress': { name: ':green_heart: ci/in-progress', color: '#0052cc' },\n // 'ci/fail': { name: ':green_heart: ci/fail', color: '#e11d21' },\n // 'ci/passed': { name: ':green_heart: ci/passed', color: '#86f9b4' },\n\n /* code */\n 'code/needs-review': {\n name: ':ok_hand: code/needs-review',\n color: '#FFC44C',\n },\n 'code/review-requested': {\n name: ':ok_hand: code/review-requested',\n color: '#DAE1E6',\n },\n 'code/changes-requested': {\n name: ':ok_hand: code/changes-requested',\n color: '#e11d21',\n },\n 'code/approved': {\n name: ':ok_hand: code/approved',\n color: '#64DD17',\n },\n\n /* design */\n 'design/needs-review': {\n name: ':art: design/needs-review',\n color: '#FFC44C',\n },\n 'design/review-requested': {\n name: ':art: design/review-requested',\n color: '#DAE1E6',\n },\n 'design/changes-requested': {\n name: ':art: design/changes-requested',\n color: '#e11d21',\n },\n 'design/approved': {\n name: ':art: design/approved',\n color: '#64DD17',\n },\n\n /* auto merge */\n 'merge/automerge': {\n name: ':soon: automerge',\n color: '#64DD17',\n },\n\n /* feature-branch */\n 'feature-branch': {\n name: 'feature-branch',\n color: '#7FCEFF',\n },\n },\n\n review: {\n ci: {\n inProgress: 'ci/in-progress',\n succeeded: 'ci/success',\n failed: 'ci/fail',\n },\n dev: {\n needsReview: 'code/needs-review',\n requested: 'code/review-requested',\n changesRequested: 'code/changes-requested',\n approved: 'code/approved',\n },\n design: {\n needsReview: 'design/needs-review',\n requested: 'design/review-requested',\n changesRequested: 'design/changes-requested',\n approved: 'design/approved',\n },\n },\n },\n};\n\nexport default config;\n","import { Config } from './types';\n\nconst config: Config<'dev'> = {\n autoAssignToCreator: true,\n trimTitle: true,\n requiresReviewRequest: false,\n prDefaultOptions: {\n featureBranch: false,\n autoMerge: false,\n deleteAfterMerge: true,\n },\n parsePR: {\n title: [\n {\n regExp:\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^(revert: )?(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\\(([a-z\\-/]*)\\))?:\\s/,\n error: {\n title: 'Title does not match commitlint conventional',\n summary:\n 'https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional',\n },\n },\n ],\n },\n groups: {\n dev: {\n christophehurpeau: 'christophe@hurpeau.com',\n 'chris-reviewflow': 'christophe.hurpeau+reviewflow@gmail.com',\n tilap: 'jlavinh@gmail.com',\n },\n },\n waitForGroups: {\n dev: [],\n },\n labels: {\n list: {\n // /* ci */\n // 'ci/in-progress': { name: ':green_heart: ci/in-progress', color: '#0052cc' },\n // 'ci/fail': { name: ':green_heart: ci/fail', color: '#e11d21' },\n // 'ci/passed': { name: ':green_heart: ci/passed', color: '#86f9b4' },\n\n /* code */\n 'code/needs-review': {\n name: ':ok_hand: code/needs-review',\n color: '#FFD57F',\n },\n 'code/review-requested': {\n name: ':ok_hand: code/review-requested',\n color: '#B2E1FF',\n },\n 'code/changes-requested': {\n name: ':ok_hand: code/changes-requested',\n color: '#e11d21',\n },\n 'code/approved': {\n name: ':ok_hand: code/approved',\n color: '#64DD17',\n },\n\n /* auto merge */\n 'merge/automerge': {\n name: ':soon: automerge',\n color: '#64DD17',\n },\n\n /* feature-branch */\n 'feature-branch': {\n name: 'feature-branch',\n color: '#7FCEFF',\n },\n },\n\n review: {\n ci: {\n inProgress: 'ci/in-progress',\n succeeded: 'ci/success',\n failed: 'ci/fail',\n },\n dev: {\n needsReview: 'code/needs-review',\n requested: 'code/review-requested',\n changesRequested: 'code/changes-requested',\n approved: 'code/approved',\n },\n },\n },\n};\n\nexport default config;\n","import { Config as ConfigType } from './types';\nimport ornikar from './ornikar';\nimport christophehurpeau from './christophehurpeau';\n\nexport type Config = ConfigType;\n\nexport const teamConfigs: { [owner: string]: Config } = {\n ornikar,\n christophehurpeau,\n};\n\n// flat requires node 11\n// export const getMembers = (\n// groups: Record,\n// ): string[] => {\n// return Object.values(groups).flat(1);\n// };\n","export type Options = 'featureBranch' | 'autoMerge' | 'deleteAfterMerge';\n\nexport const options: Options[] = [\n 'featureBranch',\n 'autoMerge',\n 'deleteAfterMerge',\n];\nexport const optionsRegexps: { name: Options; regexp: RegExp }[] = options.map(\n (option) => ({\n name: option,\n regexp: new RegExp(`\\\\[([ xX]?)]\\\\s*`),\n }),\n);\n\nexport const optionsLabels: { name: Options; label: string }[] = [\n { name: 'featureBranch', label: 'This PR is a feature branch' },\n {\n name: 'autoMerge',\n label:\n 'Auto merge when this PR is ready and has no failed statuses. (Also has a queue per repo to prevent multiple useless \"Update branch\" triggers)',\n },\n {\n name: 'deleteAfterMerge',\n label: 'Automatic branch delete after this PR is merged',\n },\n];\n","import { Options, optionsRegexps } from './prOptions';\n\nconst commentStart = '';\nconst commentEnd = \"\";\n\nconst regexpCols = /^(.*)((.*)).*$/is;\nconst regexpReviewflowCol = /^(\\s*<\\/td>]*>)\\s*(.*)\\s*(<\\/td><\\/tr><\\/table>\\s*)\\s*$/is;\n\nconst parseOptions = (\n content: string,\n defaultConfig: Record,\n): Record => {\n return optionsRegexps.reduce(\n (acc, { name, regexp }) => {\n const match = regexp.exec(content);\n acc[name] = !match\n ? defaultConfig[name] || false\n : match[1] === 'x' || match[1] === 'X';\n return acc;\n },\n {} as any,\n ) as Record;\n};\n\nexport const parseBody = (\n description: string,\n defaultConfig: Record,\n) => {\n const match = regexpCols.exec(description);\n if (!match) return null;\n const [, content, reviewFlowCol, reviewflowContent] = match;\n const reviewFlowColMatch = regexpReviewflowCol.exec(reviewFlowCol);\n if (!reviewFlowColMatch) {\n return {\n content,\n reviewflowContentCol: reviewflowContent,\n reviewflowContentColPrefix: commentStart,\n reviewflowContentColSuffix: commentEnd,\n options: parseOptions(reviewFlowCol, defaultConfig),\n };\n }\n const [\n ,\n reviewflowContentColPrefix,\n reviewflowContentCol,\n reviewflowContentColSuffix,\n ] = reviewFlowColMatch;\n\n return {\n content,\n reviewflowContentCol,\n reviewflowContentColPrefix,\n reviewflowContentColSuffix,\n options: parseOptions(reviewflowContentCol, defaultConfig),\n };\n};\n","/* eslint-disable max-lines */\nimport { Context } from 'probot';\n// eslint-disable-next-line import/no-cycle\nimport { RepoContext } from '../../context/repoContext';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { parseBody } from './utils/parseBody';\n\nconst hasFailedStatusOrChecks = async (\n context: Context,\n repoContext: RepoContext,\n pr: any,\n) => {\n const checks = await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n per_page: 100,\n }),\n );\n\n const failedChecks = checks.data.check_runs.filter(\n (check) => check.conclusion === 'failure',\n );\n\n if (failedChecks.length !== 0) {\n context.log.info(`automerge not possible: failed check pr ${pr.id}`, {\n checks: failedChecks.map((check) => check.name),\n });\n return true;\n }\n\n const combinedStatus = await context.github.repos.getCombinedStatusForRef(\n context.repo({\n ref: pr.head.sha,\n per_page: 100,\n }),\n );\n\n if (combinedStatus.data.state === 'failure') {\n const failedStatuses = combinedStatus.data.statuses.filter(\n (status) => status.state === 'failure' || status.state === 'error',\n );\n\n context.log.info(`automerge not possible: failed status pr ${pr.id}`, {\n statuses: failedStatuses.map((status) => status.context),\n });\n\n return true;\n }\n\n return false;\n};\n\nexport const autoMergeIfPossible = async (\n context: Context,\n repoContext: RepoContext,\n pr: any = context.payload.pull_request,\n prLabels: LabelResponse[] = pr.labels,\n): Promise => {\n const autoMergeLabel = repoContext.labels['merge/automerge'];\n if (!autoMergeLabel) return false;\n\n const createMergeLockPrFromPr = () => ({\n id: pr.id,\n number: pr.number,\n branch: pr.head.ref,\n });\n\n if (!prLabels.find((l): boolean => l.id === autoMergeLabel.id)) {\n context.log.debug('automerge not possible: no label');\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n }\n\n if (\n repoContext.hasNeedsReview(prLabels) ||\n repoContext.hasRequestedReview(prLabels)\n ) {\n context.log.debug('automerge not possible: blocking labels');\n // repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n }\n\n const lockedPr = repoContext.getMergeLockedPr();\n if (lockedPr && lockedPr.number !== pr.number) {\n context.log.info(`automerge not possible: locked pr ${pr.id}`);\n repoContext.pushAutomergeQueue(createMergeLockPrFromPr());\n return false;\n }\n\n repoContext.addMergeLockPr(createMergeLockPrFromPr());\n\n if (pr.mergeable === undefined) {\n const prResult = await context.github.pulls.get(\n context.repo({\n pull_number: pr.number,\n }),\n );\n pr = prResult.data;\n }\n\n if (pr.merged) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n context.log.info(`automerge not possible: already merged pr ${pr.id}`);\n return false;\n }\n\n context.log.info(\n `automerge?: ${pr.id}, mergeable=${pr.mergeable} state=${\n pr.mergeable_state\n }`,\n );\n\n // https://github.com/octokit/octokit.net/issues/1763\n if (\n !(\n pr.mergeable_state === 'clean' ||\n pr.mergeable_state === 'has_hooks' ||\n pr.mergeable_state === 'unstable'\n )\n ) {\n if (!pr.mergeable_state || pr.mergeable_state === 'unknown') {\n context.log.info(`automerge not possible: rescheduling ${pr.id}`);\n // GitHub is determining whether the pull request is mergeable\n repoContext.reschedule(context, createMergeLockPrFromPr());\n return false;\n }\n\n if (pr.head.ref.startsWith('renovate/')) {\n if (pr.mergeable_state === 'behind' || pr.mergeable_state === 'dirty') {\n context.log.info(\n `automerge not possible: rebase renovate branch pr ${pr.id}`,\n );\n // TODO check if has commits not made by renovate https://github.com/ornikar/shared-configs/pull/47#issuecomment-445767120\n\n await context.github.issues.update(\n context.repo({\n number: pr.number,\n body: pr.body.replace(\n '[ ] ',\n '[x] ',\n ),\n }),\n );\n return false;\n }\n\n if (await hasFailedStatusOrChecks(context, repoContext, pr)) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n } else if (pr.mergeable_state === 'blocked') {\n // waiting for reschedule in status (pr-handler/status.ts)\n return false;\n }\n\n context.log.info(\n `automerge not possible: renovate with mergeable_state=${\n pr.mergeable_state\n }`,\n );\n return false;\n }\n\n if (pr.mergeable_state === 'blocked') {\n if (await hasFailedStatusOrChecks(context, repoContext, pr)) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n } else {\n // waiting for reschedule in status (pr-handler/status.ts)\n return false;\n }\n }\n\n if (pr.mergeable_state === 'behind') {\n context.log.info('automerge not possible: update branch', {\n head: pr.head.ref,\n base: pr.base.ref,\n });\n\n await context.github.repos.merge({\n owner: pr.head.repo.owner.login,\n repo: pr.head.repo.name,\n head: pr.base.ref,\n base: pr.head.ref,\n });\n\n return false;\n }\n\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n context.log.info(\n `automerge not possible: not mergeable mergeable_state=${\n pr.mergeable_state\n }`,\n );\n return false;\n }\n\n try {\n context.log.info(`automerge pr #${pr.number}`);\n const parsedBody = parseBody(pr.body, repoContext.config.prDefaultOptions);\n const mergeResult = await context.github.pulls.merge({\n merge_method:\n parsedBody && parsedBody.options.featureBranch ? 'merge' : 'squash',\n owner: pr.head.repo.owner.login,\n repo: pr.head.repo.name,\n pull_number: pr.number,\n commit_title: `${pr.title} (#${pr.number})`,\n commit_message: '', // TODO add BC\n });\n context.log.debug('merge result:', mergeResult.data);\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return Boolean(mergeResult.data.merged);\n } catch (err) {\n context.log.info('could not merge:', err.message);\n repoContext.reschedule(context, createMergeLockPrFromPr());\n return false;\n }\n};\n","import { Context } from 'probot';\nimport { Config } from '../teamconfigs';\n\nexport interface LabelResponse {\n id: number;\n node_id: string;\n url: string;\n name: string;\n description: string;\n color: string;\n default: boolean;\n}\n\nexport interface Labels {\n [key: string]: LabelResponse;\n}\n\nexport const initRepoLabels = async (\n context: Context,\n config: Config,\n): Promise => {\n const { data: labels } = await context.github.issues.listLabelsForRepo(\n context.repo({ per_page: 100 }),\n );\n const finalLabels: Record = {};\n\n for (const [labelKey, labelConfig] of Object.entries(config.labels.list)) {\n const labelColor = labelConfig.color.slice(1);\n const description = `Generated by review-flow for ${labelKey}`;\n\n let existingLabel = labels.find((label) => label.name === labelConfig.name);\n if (!existingLabel) {\n existingLabel = labels.find((label) => label.description === description);\n }\n if (!existingLabel) {\n if (labelKey === 'design/needs-review') {\n existingLabel = labels.find(\n (label) => label.name === 'needs-design-review',\n );\n }\n if (labelKey === 'design/approved') {\n existingLabel = labels.find(\n (label) => label.name === 'design-reviewed',\n );\n }\n }\n\n if (!existingLabel) {\n const result = await context.github.issues.createLabel(\n context.repo({\n name: labelConfig.name,\n color: labelColor,\n description,\n }),\n );\n finalLabels[labelKey] = result.data;\n } else if (\n existingLabel.name !== labelConfig.name ||\n existingLabel.color !== labelColor // ||\n // TODO: description is never updated\n // existingLabel.description !== description\n ) {\n context.log.info('Needs to update label', {\n current_name: existingLabel.name,\n name: existingLabel.name !== labelConfig.name && labelConfig.name,\n color: existingLabel.color !== labelColor && labelColor,\n description: existingLabel.description !== description && description,\n });\n\n const result = await context.github.issues.updateLabel(\n context.repo({\n current_name: existingLabel.name,\n name: labelConfig.name,\n color: labelColor,\n description,\n }),\n );\n finalLabels[labelKey] = result.data;\n } else {\n finalLabels[labelKey] = existingLabel;\n }\n }\n\n return finalLabels;\n};\n","export const getKeys = (o: T): (keyof T)[] =>\n Object.keys(o) as (keyof T)[];\n","import { WebClient } from '@slack/web-api';\nimport { Context } from 'probot';\nimport { Config } from '../teamconfigs';\nimport { getKeys } from './utils';\n\nexport interface TeamSlack {\n mention: (githubLogin: string) => string;\n postMessage: (githubLogin: string, text: string) => Promise;\n}\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport const initTeamSlack = async (\n context: Context,\n config: Config,\n): Promise => {\n if (!config.slackToken) {\n return {\n mention: (githubLogin: string) => '',\n postMessage: (githubLogin: string, text: string) => Promise.resolve(),\n };\n }\n\n const githubLoginToSlackEmail = getKeys(config.groups).reduce<{\n [login: string]: string;\n }>((acc, groupName) => {\n Object.assign(acc, config.groups[groupName]);\n return acc;\n }, {});\n\n const slackClient = new WebClient(config.slackToken);\n const allUsers: any = await slackClient.users.list({ limit: 200 });\n const members: [string, { member: any; im: any }][] = Object.values(\n githubLoginToSlackEmail,\n )\n .map((email) => {\n const member = allUsers.members.find(\n (user: any) => user.profile.email === email,\n );\n if (!member) {\n console.warn(`Could not find user ${email}`);\n return;\n }\n return [email, { member, im: undefined }] as [\n string,\n { member: any; im: any }\n ];\n })\n .filter(ExcludesFalsy);\n\n for (const [, user] of members) {\n try {\n const im: any = await slackClient.im.open({ user: user.member.id });\n user.im = im.channel;\n } catch (err) {\n console.error(err);\n }\n }\n\n const membersMap = new Map(members);\n\n const getUserFromGithubLogin = (githubLogin: string) => {\n const email = githubLoginToSlackEmail[githubLogin];\n if (!email) return null;\n return membersMap.get(email);\n };\n\n return {\n mention: (githubLogin: string) => {\n const user = getUserFromGithubLogin(githubLogin);\n if (!user) return githubLogin;\n return `<@${user.member.id}>`;\n },\n postMessage: async (githubLogin: string, text: string) => {\n context.log.info('send slack', { githubLogin, text });\n if (process.env.DRY_RUN) return;\n\n const user = getUserFromGithubLogin(githubLogin);\n if (!user || !user.im) return;\n await slackClient.chat.postMessage({\n channel: user.im.id,\n text,\n });\n },\n };\n};\n","import { Context } from 'probot';\nimport { Config } from '../teamconfigs';\nimport { initTeamSlack, TeamSlack } from './initTeamSlack';\nimport { getKeys } from './utils';\n\nexport interface TeamContext {\n config: Config;\n slack: TeamSlack;\n getReviewerGroup: (githubLogin: string) => string | undefined;\n getReviewerGroups: (githubLogins: string[]) => string[];\n reviewShouldWait: (\n reviewerGroup: GroupNames | undefined,\n requestedReviewers: any[],\n {\n includesReviewerGroup,\n includesWaitForGroups,\n }: { includesReviewerGroup?: boolean; includesWaitForGroups?: boolean },\n ) => boolean;\n}\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nconst initTeamContext = async (\n context: Context,\n config: Config,\n): Promise => {\n const slackPromise = initTeamSlack(context, config);\n\n const githubLoginToGroup = getKeys(config.groups).reduce>(\n (acc, groupName) => {\n Object.keys(config.groups[groupName]).forEach((login) => {\n acc.set(login, groupName);\n });\n return acc;\n },\n new Map(),\n );\n\n const getReviewerGroups = (githubLogins: string[]) => [\n ...new Set(\n githubLogins\n .map((githubLogin) => githubLoginToGroup.get(githubLogin))\n .filter(Boolean),\n ),\n ];\n\n return {\n config,\n getReviewerGroup: (githubLogin) => githubLoginToGroup.get(githubLogin),\n getReviewerGroups: (githubLogins) => [\n ...new Set(\n githubLogins\n .map((githubLogin) => githubLoginToGroup.get(githubLogin))\n .filter(ExcludesFalsy),\n ),\n ],\n\n reviewShouldWait: (\n reviewerGroup,\n requestedReviewers,\n { includesReviewerGroup, includesWaitForGroups },\n ) => {\n if (!reviewerGroup) return false;\n\n const requestedReviewerGroups = getReviewerGroups(\n requestedReviewers.map((request) => request.login),\n );\n\n // contains another request of a reviewer in the same group\n if (\n includesReviewerGroup &&\n requestedReviewerGroups.includes(reviewerGroup)\n ) {\n return true;\n }\n\n // contains a request from a dependent group\n if (config.waitForGroups && includesWaitForGroups) {\n const waitForGroups = config.waitForGroups;\n return requestedReviewerGroups.some((group) =>\n waitForGroups[reviewerGroup].includes(group),\n );\n }\n\n return false;\n },\n\n slack: await slackPromise,\n };\n};\n\nconst teamContextsPromise = new Map();\nconst teamContexts = new Map();\n\nexport const obtainTeamContext = (\n context: Context,\n config: Config,\n): Promise => {\n const owner = context.payload.repository.owner;\n\n const existingTeamContext = teamContexts.get(owner.login);\n if (existingTeamContext) return existingTeamContext;\n\n const existingPromise = teamContextsPromise.get(owner.login);\n if (existingPromise) return Promise.resolve(existingPromise);\n\n const promise = initTeamContext(context, config);\n teamContextsPromise.set(owner.login, promise);\n\n return promise.then((teamContext) => {\n teamContextsPromise.delete(owner.login);\n teamContexts.set(owner.login, teamContext);\n return teamContext;\n });\n};\n","/* eslint-disable max-lines */\n\nimport { Lock } from 'lock';\nimport { Context } from 'probot';\nimport { teamConfigs, Config } from '../teamconfigs';\n// eslint-disable-next-line import/no-cycle\nimport { autoMergeIfPossible } from '../pr-handlers/actions/autoMergeIfPossible';\nimport { initRepoLabels, LabelResponse, Labels } from './initRepoLabels';\nimport { obtainTeamContext, TeamContext } from './teamContext';\n\nexport interface LockedMergePr {\n id: number;\n number: number;\n branch: string;\n}\n\ninterface RepoContextWithoutTeamContext {\n labels: Labels;\n protectedLabelIds: readonly LabelResponse['id'][];\n\n hasNeedsReview: (labels: LabelResponse[]) => boolean;\n hasRequestedReview: (labels: LabelResponse[]) => boolean;\n hasChangesRequestedReview: (labels: LabelResponse[]) => boolean;\n hasApprovesReview: (labels: LabelResponse[]) => boolean;\n getNeedsReviewGroupNames: (labels: LabelResponse[]) => GroupNames[];\n\n lockPROrPRS(\n prIdOrIds: string | string[],\n callback: () => Promise | void,\n ): Promise;\n\n getMergeLockedPr(): LockedMergePr;\n addMergeLockPr(pr: LockedMergePr): void;\n removeMergeLockedPr(context: Context, pr: LockedMergePr): void;\n reschedule(context: Context, pr: LockedMergePr): void;\n pushAutomergeQueue(pr: LockedMergePr): void;\n}\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport type RepoContext = TeamContext<\n GroupNames\n> &\n RepoContextWithoutTeamContext;\n\nasync function initRepoContext(\n context: Context,\n config: Config,\n): Promise> {\n const teamContext = await obtainTeamContext(context, config);\n const repoContext = Object.create(teamContext);\n\n const [labels] = await Promise.all([initRepoLabels(context, config)]);\n\n const reviewGroupNames = Object.keys(config.groups) as GroupNames[];\n\n const needsReviewLabelIds = reviewGroupNames\n .map((key: GroupNames) => config.labels.review[key].needsReview)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const requestedReviewLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].requested)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const changesRequestedLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].changesRequested)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const approvedReviewLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].approved)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const protectedLabelIds = [\n ...requestedReviewLabelIds,\n ...changesRequestedLabelIds,\n ...approvedReviewLabelIds,\n ];\n\n const labelIdToGroupName = new Map();\n reviewGroupNames.forEach((key) => {\n const reviewGroupLabels = config.labels.review[key] as any;\n Object.keys(reviewGroupLabels).forEach((labelKey: string) => {\n labelIdToGroupName.set(labels[reviewGroupLabels[labelKey]].id, key);\n });\n });\n\n // const updateStatusCheck = (context, reviewGroup, statusInfo) => {};\n\n const hasNeedsReview = (labels: LabelResponse[]) =>\n labels.some((label) => needsReviewLabelIds.includes(label.id));\n const hasRequestedReview = (labels: LabelResponse[]) =>\n labels.some((label) => requestedReviewLabelIds.includes(label.id));\n const hasChangesRequestedReview = (labels: LabelResponse[]) =>\n labels.some((label) => changesRequestedLabelIds.includes(label.id));\n const hasApprovesReview = (labels: LabelResponse[]) =>\n labels.some((label) => approvedReviewLabelIds.includes(label.id));\n\n const getNeedsReviewGroupNames = (labels: LabelResponse[]): GroupNames[] =>\n labels\n .filter((label) => needsReviewLabelIds.includes(label.id))\n .map((label) => labelIdToGroupName.get(label.id))\n .filter(ExcludesFalsy);\n\n const lock = Lock();\n let lockMergePr: LockedMergePr | undefined;\n const automergeQueue: LockedMergePr[] = [];\n\n const lockPROrPRS = (\n prIdOrIds: string | string[],\n callback: () => Promise | void,\n ): Promise =>\n new Promise((resolve, reject) => {\n console.log('lock: try to lock pr', { prIdOrIds });\n lock(prIdOrIds, async (createReleaseCallback) => {\n const release = createReleaseCallback(() => {});\n console.log('lock: lock acquired', { prIdOrIds });\n try {\n await callback();\n } catch (err) {\n console.log('lock: release pr (with error)', { prIdOrIds });\n release();\n reject(err);\n return;\n }\n console.log('lock: release pr', { prIdOrIds });\n release();\n resolve();\n });\n });\n\n const reschedule = (context: Context, pr: LockedMergePr) => {\n if (!pr) throw new Error('Cannot reschedule undefined');\n context.log.info('reschedule', pr);\n setTimeout(() => {\n lockPROrPRS('reschedule', () => {\n return lockPROrPRS(String(pr.id), async () => {\n const prResult = await context.github.pulls.get(\n context.repo({\n pull_number: pr.number,\n }),\n );\n await autoMergeIfPossible(context, repoContext, prResult.data);\n });\n });\n }, 1000);\n };\n\n return Object.assign(repoContext, {\n labels,\n protectedLabelIds,\n hasNeedsReview,\n hasRequestedReview,\n hasChangesRequestedReview,\n hasApprovesReview,\n getNeedsReviewGroupNames,\n\n getMergeLockedPr: () => lockMergePr,\n addMergeLockPr: (pr: LockedMergePr): void => {\n console.log('merge lock: lock', pr);\n if (lockMergePr && lockMergePr.number === pr.number) return;\n if (lockMergePr) throw new Error('Already have lock');\n lockMergePr = pr;\n },\n removeMergeLockedPr: (context, pr: LockedMergePr): void => {\n console.log('merge lock: remove', pr);\n if (!lockMergePr || lockMergePr.number !== pr.number) return;\n lockMergePr = automergeQueue.shift();\n console.log('merge lock: next', lockMergePr);\n if (lockMergePr) {\n reschedule(context, lockMergePr);\n }\n },\n pushAutomergeQueue: (pr: LockedMergePr): void => {\n console.log('merge lock: push queue', {\n pr,\n lockMergePr,\n automergeQueue,\n });\n if (!automergeQueue.some((p) => p.number === pr.number)) {\n automergeQueue.push(pr);\n }\n },\n reschedule,\n\n lockPROrPRS,\n } as RepoContextWithoutTeamContext);\n}\n\nconst repoContextsPromise = new Map>();\nconst repoContexts = new Map();\n\nexport const obtainRepoContext = (\n context: Context,\n): Promise | RepoContext | null => {\n const repo = context.payload.repository;\n if (\n repo.name === 'reviewflow-test' &&\n process.env.NAME !== 'reviewflow-test'\n ) {\n return null;\n }\n const owner = repo.owner;\n if (!teamConfigs[owner.login]) {\n console.warn(owner.login, Object.keys(teamConfigs));\n return null;\n }\n const key = repo.id;\n\n const existingRepoContext = repoContexts.get(key);\n if (existingRepoContext) return existingRepoContext;\n\n const existingPromise = repoContextsPromise.get(key);\n if (existingPromise) return Promise.resolve(existingPromise);\n\n const promise = initRepoContext(context, teamConfigs[owner.login]);\n repoContextsPromise.set(key, promise);\n\n return promise.then((repoContext) => {\n repoContextsPromise.delete(key);\n repoContexts.set(key, repoContext);\n return repoContext;\n });\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { obtainRepoContext, RepoContext } from '../context/repoContext';\n\nexport type Handler = (\n context: Context,\n repoContext: RepoContext,\n) => Promise;\n\nexport type CallbackWithRepoContext = (\n repoContext: RepoContext,\n) => void | Promise;\n\nexport const handlerPullRequestChange = async <\n T extends Webhooks.WebhookPayloadPullRequest\n>(\n context: Context,\n callback: CallbackWithRepoContext,\n): Promise => {\n const repoContext = await obtainRepoContext(context);\n if (!repoContext) return;\n\n repoContext.lockPROrPRS(String(context.payload.pull_request.id), async () => {\n await callback(repoContext);\n });\n};\n\ntype CallbackContextAndRepoContext = (\n context: Context,\n repoContext: RepoContext,\n) => void | Promise;\n\nexport const createHandlerPullRequestChange = <\n T extends Webhooks.WebhookPayloadPullRequest\n>(\n callback: CallbackContextAndRepoContext,\n) => (context: Context) => {\n return handlerPullRequestChange(context, (repoContext) =>\n callback(context, repoContext),\n );\n};\n\nexport const createHandlerPullRequestsChange = (\n getPullRequests: (\n context: Context,\n repoContext: RepoContext,\n ) => { id: string | number }[],\n callback: CallbackContextAndRepoContext,\n) => async (context: Context): Promise => {\n const repoContext = await obtainRepoContext(context);\n if (!repoContext) return;\n\n const prs = getPullRequests(context, repoContext);\n if (prs.length === 0) return;\n return repoContext.lockPROrPRS(prs.map((pr) => String(pr.id)), () =>\n callback(context, repoContext),\n );\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Handler } from '../utils';\n\nexport const autoAssignPRToCreator: Handler<\n Webhooks.WebhookPayloadPullRequest\n> = async (context, repoContext) => {\n if (!repoContext.config.autoAssignToCreator) return;\n\n const pr = context.payload.pull_request;\n if (pr.assignees.length !== 0) return;\n if (pr.user.type === 'Bot') return;\n\n await context.github.issues.addAssignees(\n context.issue({\n assignees: [pr.user.login],\n }),\n );\n};\n","export const cleanTitle = (title: string): string =>\n title\n .trim()\n .replace(/[\\s-]+\\[?\\s*ONK[- ](\\d+)\\s*]?\\s*$/i, ' ONK-$1')\n .replace(/^([A-Za-z]+)[/:]\\s*/, (s, arg1) => `${arg1.toLowerCase()}: `)\n .replace(/^Revert \"([^\"]+)\"$/, 'revert: $1')\n // eslint-disable-next-line unicorn/no-unsafe-regex\n .replace(/^(revert:.*)(\\s+\\(#\\d+\\))$/, '$1');\n","import { StatusInfo } from '../../../teamconfigs/types';\nimport { parseBody } from './parseBody';\nimport { Options, optionsLabels } from './prOptions';\n\nconst toMarkdownOptions = (options: Record) => {\n return optionsLabels\n .map(\n ({ name, label }) =>\n `- [${options[name] ? 'x' : ' '}] ${label}`,\n )\n .join('\\n');\n};\n\nconst toMarkdownInfos = (infos: StatusInfo[]) => {\n return infos\n .map((info) => {\n if (info.url) return `[${info.title}](${info.url})`;\n return info.title;\n })\n .join('\\n');\n};\n\ninterface UpdatedBodyWithOptions {\n body: string;\n options?: Record;\n}\n\nexport const updateBody = (\n body: string,\n defaultConfig: Record,\n infos?: StatusInfo[],\n updateOptions?: Partial>,\n): UpdatedBodyWithOptions => {\n const parsed = parseBody(body, defaultConfig);\n if (!parsed) {\n console.info('could not parse body');\n return { body };\n }\n const {\n content,\n reviewflowContentCol,\n reviewflowContentColPrefix,\n reviewflowContentColSuffix,\n options,\n } = parsed;\n\n // eslint-disable-next-line no-nested-ternary\n const infosParagraph = !infos\n ? reviewflowContentCol.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^\\s*(?:(#### Infos:.*)?#### Options:)?.*$/s,\n '$1',\n )\n : infos.length !== 0\n ? `#### Infos:\\n${toMarkdownInfos(infos)}\\n`\n : '';\n\n const updatedOptions = !updateOptions\n ? options\n : { ...options, ...updateOptions };\n\n return {\n options: updatedOptions,\n body: `${content}${reviewflowContentColPrefix}\n${infosParagraph}#### Options:\n${toMarkdownOptions(updatedOptions)}\n${reviewflowContentColSuffix}\n`,\n };\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { RepoContext } from '../../context/repoContext';\nimport { StatusError, StatusInfo } from '../../teamconfigs/types';\nimport { cleanTitle } from './utils/cleanTitle';\nimport { updateBody } from './utils/updateBody';\n\ninterface StatusWithInfo {\n name: string;\n info: StatusInfo;\n error?: undefined;\n}\n\ninterface StatusWithError {\n name: string;\n error: StatusError;\n info?: undefined;\n}\n\ntype Status = StatusWithInfo | StatusWithError;\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport const editOpenedPR = async (\n context: Context,\n repoContext: RepoContext,\n): Promise => {\n const repo = context.payload.repository;\n const pr = context.payload.pull_request;\n\n // do not lint pr from forks\n if (pr.head.repo.id !== repo.id) return;\n\n const title = repoContext.config.trimTitle ? cleanTitle(pr.title) : pr.title;\n\n const isPrFromBot = pr.user.type === 'Bot';\n\n const statuses: Status[] = [];\n\n const errorRule = repoContext.config.parsePR.title.find((rule) => {\n if (rule.bot === false && isPrFromBot) return false;\n\n const match = rule.regExp.exec(pr.title);\n if (match === null) {\n if (rule.status) {\n statuses.push({ name: rule.status, error: rule.error });\n }\n return true;\n }\n\n if (rule.status && rule.statusInfoFromMatch) {\n statuses.push({\n name: rule.status,\n info: rule.statusInfoFromMatch(match),\n });\n return false;\n }\n\n return false;\n });\n\n const date = new Date().toISOString();\n\n const hasLintPrCheck = (await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n }),\n )).data.check_runs.find(\n (check) => check.name === `${process.env.NAME}/lint-pr`,\n );\n\n await Promise.all(\n [\n ...statuses.map(({ name, error, info }) =>\n context.github.repos.createStatus(\n context.repo({\n context: `${process.env.NAME}/${name}`,\n sha: pr.head.sha,\n state: (error ? 'failure' : 'success') as 'failure' | 'success',\n target_url: error ? undefined : (info as StatusInfo).url,\n description: error ? error.title : (info as StatusInfo).title,\n }),\n ),\n ),\n hasLintPrCheck &&\n context.github.checks.create(\n context.repo({\n name: `${process.env.NAME}/lint-pr`,\n head_sha: pr.head.sha,\n status: 'completed' as 'completed',\n conclusion: (errorRule ? 'failure' : 'success') as\n | 'failure'\n | 'success',\n started_at: date,\n completed_at: date,\n output: errorRule\n ? errorRule.error\n : {\n title: '✓ Your PR is valid',\n summary: '',\n },\n }),\n ),\n !hasLintPrCheck &&\n context.github.repos.createStatus(\n context.repo({\n context: `${process.env.NAME}/lint-pr`,\n sha: pr.head.sha,\n state: (errorRule ? 'failure' : 'success') as 'failure' | 'success',\n target_url: undefined,\n description: errorRule\n ? errorRule.error.title\n : '✓ Your PR is valid',\n }),\n ),\n ].filter(ExcludesFalsy),\n );\n\n const featureBranchLabel = repoContext.labels['feature-branch'];\n const automergeLabel = repoContext.labels['merge/automerge'];\n\n const prHasFeatureBranchLabel = Boolean(\n featureBranchLabel &&\n pr.labels.find((label): boolean => label.id === featureBranchLabel.id),\n );\n\n const prHasAutoMergeLabel = Boolean(\n automergeLabel &&\n pr.labels.find((label): boolean => label.id === automergeLabel.id),\n );\n\n const defaultOptions = {\n ...repoContext.config.prDefaultOptions,\n autoMerge: prHasAutoMergeLabel,\n featureBranch: prHasFeatureBranchLabel,\n };\n\n const { body, options } = updateBody(pr.body, defaultOptions, statuses\n .filter((status) => status.info && status.info.inBody)\n .map((status) => status.info) as StatusInfo[]);\n\n const hasDiffInTitle = pr.title !== title;\n const hasDiffInBody = pr.body !== body;\n if (hasDiffInTitle || hasDiffInBody) {\n const update: Partial> = {};\n if (hasDiffInTitle) {\n update.title = title;\n pr.title = title;\n }\n if (hasDiffInBody) {\n update.body = body;\n pr.body = body;\n }\n\n await context.github.issues.update(context.issue(update));\n }\n\n if (options && (featureBranchLabel || automergeLabel)) {\n if (featureBranchLabel) {\n if (prHasFeatureBranchLabel && !options.featureBranch) {\n await context.github.issues.removeLabel(\n context.issue({ name: featureBranchLabel.name }),\n );\n }\n if (options.featureBranch && !prHasFeatureBranchLabel) {\n await context.github.issues.addLabels(\n context.issue({ labels: [featureBranchLabel.name] }),\n );\n }\n }\n\n if (automergeLabel) {\n if (prHasAutoMergeLabel && !options.autoMerge) {\n await context.github.issues.removeLabel(\n context.issue({ name: automergeLabel.name }),\n );\n }\n if (options.autoMerge && !prHasAutoMergeLabel) {\n await context.github.issues.addLabels(\n context.issue({ labels: [automergeLabel.name] }),\n );\n }\n }\n }\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { RepoContext } from '../../context/repoContext';\n\nconst addStatusCheck = async function<\n E extends Webhooks.WebhookPayloadPullRequest\n>(\n context: Context,\n pr: any,\n { state, description }: { state: 'failure' | 'success'; description: string },\n): Promise {\n const hasPrCheck = (await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n }),\n )).data.check_runs.find((check) => check.name === process.env.NAME);\n\n context.log.info('add status check', { hasPrCheck, state, description });\n\n if (hasPrCheck) {\n await context.github.checks.create(\n context.repo({\n name: process.env.NAME as string,\n head_sha: pr.head.sha,\n started_at: pr.created_at,\n status: 'completed',\n conclusion: state,\n completed_at: new Date().toISOString(),\n output: {\n title: description,\n summary: '',\n },\n }),\n );\n } else {\n await context.github.repos.createStatus(\n context.repo({\n context: process.env.NAME,\n sha: pr.head.sha,\n state,\n target_url: undefined,\n description,\n }),\n );\n }\n};\n\nconst createFailedStatusCheck = (\n context: Context,\n pr: any,\n description: string,\n): Promise =>\n addStatusCheck(context, pr, {\n state: 'failure',\n description,\n });\n\nexport const updateStatusCheckFromLabels = (\n context: Context,\n repoContext: RepoContext,\n pr: any = context.payload.pull_request,\n labels: LabelResponse[] = pr.labels || [],\n): Promise => {\n context.log.info('updateStatusCheckFromLabels', {\n labels: labels.map((l) => l && l.name),\n hasNeedsReview: repoContext.hasNeedsReview(labels),\n hasApprovesReview: repoContext.hasApprovesReview(labels),\n });\n\n if (pr.requested_reviewers.length !== 0) {\n return createFailedStatusCheck(\n context,\n pr,\n `Awaiting review from: ${pr.requested_reviewers\n .map((rr: any) => rr.login)\n .join(', ')}`,\n );\n }\n\n if (repoContext.hasChangesRequestedReview(labels)) {\n return createFailedStatusCheck(\n context,\n pr,\n 'Changes requested ! Push commits or discuss changes then re-request a review.',\n );\n }\n\n const needsReviewGroupNames = repoContext.getNeedsReviewGroupNames(labels);\n\n if (needsReviewGroupNames.length !== 0) {\n return createFailedStatusCheck(\n context,\n pr,\n `Awaiting review from: ${needsReviewGroupNames.join(\n ', ',\n )}. Perhaps request someone ?`,\n );\n }\n\n if (!repoContext.hasApprovesReview(labels)) {\n if (\n repoContext.config.requiresReviewRequest &&\n !pr.head.ref.startsWith('renovate/')\n ) {\n return createFailedStatusCheck(\n context,\n pr,\n 'Awaiting review... Perhaps request someone ?',\n );\n }\n }\n\n // if (\n // repoContext.config.requiresReviewRequest &&\n // !repoContext.hasRequestedReview(labels)\n // ) {\n // return createFailedStatusCheck(\n // context,\n // pr,\n // 'You need to request someone to review the PR',\n // );\n // return;\n // }\n // return createInProgressStatusCheck(context);\n // } else if (repoContext.hasApprovesReview(labels)) {\n return addStatusCheck(context, pr, {\n state: 'success',\n description: '✓ PR ready to merge !',\n });\n // }\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { GroupLabels } from '../../teamconfigs/types';\nimport { RepoContext } from '../../context/repoContext';\nimport { updateStatusCheckFromLabels } from './updateStatusCheckFromLabels';\n\nexport const updateReviewStatus = async <\n E extends Webhooks.WebhookPayloadPullRequest,\n GroupNames extends string = any\n>(\n context: Context,\n repoContext: RepoContext,\n reviewGroup: GroupNames,\n {\n add: labelsToAdd,\n remove: labelsToRemove,\n }: {\n add?: (GroupLabels | false | undefined)[];\n remove?: (GroupLabels | false | undefined)[];\n },\n): Promise => {\n context.log.info('updateReviewStatus', {\n reviewGroup,\n labelsToAdd,\n labelsToRemove,\n });\n\n const pr = context.payload.pull_request;\n let prLabels = pr.labels || [];\n if (!reviewGroup) return prLabels;\n\n const newLabelNames = new Set(\n prLabels.map((label: LabelResponse) => label.name),\n );\n\n const toAdd = new Set();\n const toDelete = new Set();\n const labels = repoContext.labels;\n\n const getLabelFromKey = (key: GroupLabels): undefined | LabelResponse => {\n const reviewConfig = repoContext.config.labels.review[reviewGroup];\n if (!reviewConfig) return undefined;\n\n return reviewConfig[key] && labels[reviewConfig[key]]\n ? labels[reviewConfig[key]]\n : undefined;\n };\n\n if (labelsToAdd) {\n labelsToAdd.forEach((key) => {\n if (!key) return;\n const label = getLabelFromKey(key);\n if (\n !label ||\n prLabels.some((prLabel: LabelResponse) => prLabel.id === label.id)\n ) {\n return;\n }\n newLabelNames.add(label.name);\n toAdd.add(key);\n });\n }\n\n if (labelsToRemove) {\n labelsToRemove.forEach((key) => {\n if (!key) return;\n const label = getLabelFromKey(key);\n if (!label) return;\n const existing = prLabels.find(\n (prLabel: LabelResponse) => prLabel.id === label.id,\n );\n if (existing) {\n newLabelNames.delete(existing.name);\n toDelete.add(key);\n }\n });\n }\n\n const newLabelNamesArray = [...newLabelNames];\n\n context.log.info('updateReviewStatus', {\n reviewGroup,\n toAdd: [...toAdd],\n toDelete: [...toDelete],\n oldLabels: prLabels.map((l: LabelResponse) => l.name),\n newLabelNames: newLabelNamesArray,\n });\n\n // if (process.env.DRY_RUN) return;\n\n if (toAdd.size || toDelete.size) {\n const result = await context.github.issues.replaceLabels(\n context.issue({\n labels: newLabelNamesArray,\n }),\n );\n prLabels = result.data;\n }\n\n // if (toAdd.has('needsReview')) {\n // createInProgressStatusCheck(context);\n // } else if (\n // toDelete.has('needsReview') ||\n // (prLabels.length === 0 && toAdd.size === 1 && toAdd.has('approved'))\n // ) {\n await updateStatusCheckFromLabels(context, repoContext, pr, prLabels);\n // }\n\n return prLabels;\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { RepoContext } from '../../context/repoContext';\nimport { autoMergeIfPossible } from './autoMergeIfPossible';\n\nexport const autoApproveAndAutoMerge = async (\n context: Context,\n repoContext: RepoContext,\n): Promise => {\n // const autoMergeLabel = repoContext.labels['merge/automerge'];\n const codeApprovedLabel = repoContext.labels['code/approved'];\n const prLabels = context.payload.pull_request.labels;\n if (prLabels.find((l): boolean => l.id === codeApprovedLabel.id)) {\n await context.github.pulls.createReview(\n context.issue({ event: 'APPROVE' }),\n );\n }\n\n await autoMergeIfPossible(context, repoContext);\n};\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoAssignPRToCreator } from './actions/autoAssignPRToCreator';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\nimport { autoApproveAndAutoMerge } from './actions/autoApproveAndAutoMerge';\n\nexport default function opened(app: Application): void {\n app.on(\n 'pull_request.opened',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const fromRenovate = context.payload.pull_request.head.ref.startsWith(\n 'renovate/',\n );\n\n await Promise.all([\n autoAssignPRToCreator(context, repoContext),\n editOpenedPR(context, repoContext),\n fromRenovate\n ? autoApproveAndAutoMerge(context, repoContext)\n : updateReviewStatus(context, repoContext, 'dev', {\n add: ['needsReview'],\n remove: ['approved', 'changesRequested'],\n }),\n ]);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\nimport { parseBody } from './actions/utils/parseBody';\n\nexport default function closed(app: Application): void {\n app.on(\n 'pull_request.closed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const repo = context.payload.repository;\n const pr = context.payload.pull_request;\n\n if (pr.merged) {\n const parsedBody =\n pr.head.repo.id === repo.id &&\n parseBody(pr.body, repoContext.config.prDefaultOptions);\n const createMergeLockPrFromPr = () => ({\n id: pr.id,\n number: pr.number,\n branch: pr.head.ref,\n });\n await Promise.all([\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr()),\n parsedBody && parsedBody.options.deleteAfterMerge\n ? context.github.git\n .deleteRef(context.repo({ ref: `heads/${pr.head.ref}` }))\n .catch(() => {})\n : undefined,\n ]);\n } else {\n await Promise.all([\n updateReviewStatus(context, repoContext, 'dev', {\n remove: ['needsReview'],\n }),\n ]);\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewRequested(app: Application): void {\n app.on(\n 'pull_request.review_requested',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n\n // ignore if sender is self (dismissed review rerequest review)\n if (sender.type === 'Bot') return;\n\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).requested_reviewer;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n const shouldWait = false;\n // repoContext.reviewShouldWait(reviewerGroup, pr.requested_reviewers, { includesWaitForGroups: true });\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup &&\n review.state === 'REQUEST_CHANGES' &&\n // In case this is a rerequest for review\n review.user.login !== reviewer.login,\n );\n\n if (!hasChangesRequestedInReviews) {\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: ['needsReview', !shouldWait && 'requested'],\n remove: ['approved', 'changesRequested'],\n });\n }\n }\n\n if (sender.login === reviewer.login) return;\n\n if (!shouldWait && repoContext.slack) {\n repoContext.slack.postMessage(\n reviewer.login,\n `:eyes: ${repoContext.slack.mention(\n sender.login,\n )} requests your review on ${pr.html_url} !\\n> ${pr.title}`,\n );\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewRequestRemoved(app: Application): void {\n app.on(\n 'pull_request.review_request_removed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).requested_reviewer;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const hasRequestedReviewsForGroup = repoContext.reviewShouldWait(\n reviewerGroup,\n pr.requested_reviewers,\n {\n includesReviewerGroup: true,\n },\n );\n\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n const hasApprovedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'APPROVED',\n );\n\n const approved =\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n hasApprovedInReviews;\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: [\n // if changes requested by the one which requests was removed\n hasChangesRequestedInReviews && 'changesRequested',\n // if was already approved by another member in the group and has no other requests waiting\n approved && 'approved',\n ],\n // remove labels if has no other requests waiting\n remove: [\n approved && 'needsReview',\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n 'requested',\n ],\n });\n }\n\n if (sender.login === reviewer.login) return;\n\n if (repoContext.slack) {\n repoContext.slack.postMessage(\n reviewer.login,\n `:skull_and_crossbones: ${repoContext.slack.mention(\n sender.login,\n )} removed the request for your review on ${pr.html_url}`,\n );\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewSubmitted(app: Application): void {\n app.on(\n 'pull_request_review.submitted',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const pr = context.payload.pull_request;\n const { user: reviewer, state } = (context.payload as any).review;\n if (pr.user.login === reviewer.login) return;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n let merged;\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const hasRequestedReviewsForGroup = repoContext.reviewShouldWait(\n reviewerGroup,\n pr.requested_reviewers,\n {\n includesReviewerGroup: true,\n // TODO reenable this when accepted can notify request review to slack (dev accepted => design requested) and flag to disable for label (approved design ; still waiting for dev ?)\n // includesWaitForGroups: true,\n },\n );\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n const approved =\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n state === 'approved';\n\n const newLabels = await updateReviewStatus(\n context,\n repoContext,\n reviewerGroup,\n {\n add: [\n approved && 'approved',\n state === 'changes_requested' && 'changesRequested',\n ],\n remove: [\n approved && 'needsReview',\n !(\n hasRequestedReviewsForGroup || state === 'changes_requested'\n ) && 'requested',\n state === 'approved' &&\n !hasChangesRequestedInReviews &&\n 'changesRequested',\n state === 'changes_requested' && 'approved',\n ],\n },\n );\n\n if (approved && !hasChangesRequestedInReviews) {\n merged = await autoMergeIfPossible(\n context,\n repoContext,\n pr,\n newLabels,\n );\n }\n }\n\n const mention = repoContext.slack.mention(reviewer.login);\n const prUrl = pr.html_url;\n\n const message = (() => {\n if (state === 'changes_requested') {\n return `:x: ${mention} requests changes on ${prUrl}`;\n }\n if (state === 'approved') {\n return `:clap: :white_check_mark: ${mention} approves ${prUrl}${\n merged ? ' and PR is merged :tada:' : ''\n }`;\n }\n return `:speech_balloon: ${mention} commented on ${prUrl}`;\n })();\n\n repoContext.slack.postMessage(pr.user.login, message);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewDismissed(app: Application): void {\n app.on(\n 'pull_request_review.dismissed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).review.user;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: ['needsReview', 'requested'],\n remove: [\n !hasChangesRequestedInReviews && 'changesRequested',\n 'approved',\n ],\n });\n }\n\n if (repoContext.slack) {\n if (sender.login === reviewer.login) {\n repoContext.slack.postMessage(\n pr.user.login,\n `:skull: ${repoContext.slack.mention(\n reviewer.login,\n )} dismissed his review on ${pr.html_url}`,\n );\n } else {\n repoContext.slack.postMessage(\n reviewer.login,\n `:skull: ${repoContext.slack.mention(\n sender.login,\n )} dismissed your review on ${pr.html_url}`,\n );\n }\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { updateStatusCheckFromLabels } from './actions/updateStatusCheckFromLabels';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function synchronize(app: Application): void {\n app.on(\n 'pull_request.synchronize',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n // old and new sha\n // const { before, after } = context.payload;\n\n await Promise.all([\n editOpenedPR(context, repoContext),\n // addStatusCheckToLatestCommit\n updateStatusCheckFromLabels(context, repoContext),\n // call autoMergeIfPossible to re-add to the queue when push is fixed\n autoMergeIfPossible(context, repoContext),\n ]);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function edited(app: Application): void {\n app.on(\n 'pull_request.edited',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n await editOpenedPR(context, repoContext);\n\n await autoMergeIfPossible(context, repoContext);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { handlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\nimport { updateStatusCheckFromLabels } from './actions/updateStatusCheckFromLabels';\nimport { autoApproveAndAutoMerge } from './actions/autoApproveAndAutoMerge';\nimport { updateBody } from './actions/utils/updateBody';\n\nexport default function labelsChanged(app: Application): void {\n app.on(\n ['pull_request.labeled', 'pull_request.unlabeled'],\n async (context) => {\n const sender = context.payload.sender;\n const fromRenovate =\n sender.type === 'Bot' &&\n context.payload.pull_request.head.ref.startsWith('renovate/');\n\n if (sender.type === 'Bot' && !fromRenovate) {\n return;\n }\n\n await handlerPullRequestChange(context, async (repoContext) => {\n if (fromRenovate) {\n return autoApproveAndAutoMerge(context, repoContext);\n }\n\n const label = context.payload.label;\n if (repoContext.protectedLabelIds.includes(label.id)) {\n if (context.payload.action === 'labeled') {\n await context.github.issues.removeLabel(\n context.issue({ name: label.name }),\n );\n } else {\n await context.github.issues.addLabels(\n context.issue({ labels: [label.name] }),\n );\n }\n return;\n }\n\n await updateStatusCheckFromLabels(context, repoContext);\n\n const featureBranchLabel = repoContext.labels['feature-branch'];\n const automergeLabel = repoContext.labels['merge/automerge'];\n\n if (\n (featureBranchLabel && label.id === automergeLabel.id) ||\n (automergeLabel && label.id === automergeLabel.id)\n ) {\n const option: 'featureBranch' | 'autoMerge' =\n featureBranchLabel && label.id === automergeLabel.id\n ? 'featureBranch'\n : 'autoMerge';\n const prBody = context.payload.pull_request.body;\n const { body } = updateBody(\n prBody,\n repoContext.config.prDefaultOptions,\n undefined,\n {\n [option]: context.payload.action === 'labeled',\n },\n );\n\n if (body !== prBody) {\n await context.github.pulls.update(context.issue({ body }));\n }\n } else if (context.payload.action === 'labeled') {\n if (\n repoContext.labels['merge/automerge'] &&\n label.id === repoContext.labels['merge/automerge'].id\n ) {\n await autoMergeIfPossible(context, repoContext);\n }\n }\n });\n },\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestsChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function checkrunCompleted(app: Application): void {\n app.on(\n 'check_run.completed',\n createHandlerPullRequestsChange(\n (context) => context.payload.check_run.pull_requests,\n async (context, repoContext) => {\n await Promise.all(\n context.payload.check_run.pull_requests.map((pr) =>\n context.github.pulls\n .get(\n context.repo({\n number: pr.number,\n }),\n )\n .then((prResult) => {\n return autoMergeIfPossible(context, repoContext, prResult.data);\n }),\n ),\n );\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestsChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function checksuiteCompleted(app: Application): void {\n app.on(\n 'check_suite.completed',\n createHandlerPullRequestsChange(\n (context) => context.payload.check_suite.pull_requests,\n async (context, repoContext) => {\n await Promise.all(\n context.payload.check_suite.pull_requests.map((pr) =>\n context.github.pulls\n .get(\n context.repo({\n number: pr.number,\n }),\n )\n .then((prResult) => {\n return autoMergeIfPossible(context, repoContext, prResult.data);\n }),\n ),\n );\n },\n ),\n );\n}\n","import Webhooks from '@octokit/webhooks';\nimport { Application, Context } from 'probot';\nimport { LockedMergePr } from '../context/repoContext';\nimport { createHandlerPullRequestsChange } from './utils';\n\nconst isSameBranch = (\n context: Context,\n lockedPr: LockedMergePr,\n): boolean => {\n if (!lockedPr) return false;\n return !!context.payload.branches.find((b) => b.name === lockedPr.branch);\n};\n\nexport default function status(app: Application): void {\n app.on(\n 'status',\n createHandlerPullRequestsChange(\n (context, repoContext): LockedMergePr[] => {\n const lockedPr = repoContext.getMergeLockedPr();\n if (!lockedPr) return [];\n\n if (isSameBranch(context, lockedPr)) {\n return [lockedPr];\n }\n\n return [];\n },\n (context, repoContext): void => {\n const lockedPr = repoContext.getMergeLockedPr();\n // check if changed\n if (isSameBranch(context, lockedPr)) {\n repoContext.reschedule(context, lockedPr);\n }\n },\n ),\n );\n}\n","import 'dotenv/config';\nimport { Probot, Application } from 'probot';\nimport openedHandler from './pr-handlers/opened';\nimport closedHandler from './pr-handlers/closed';\nimport reviewRequestedHandler from './pr-handlers/reviewRequested';\nimport reviewRequestRemovedHandler from './pr-handlers/reviewRequestRemoved';\nimport reviewSubmittedHandler from './pr-handlers/reviewSubmitted';\nimport reviewDismissedHandler from './pr-handlers/reviewDismissed';\nimport synchromizeHandler from './pr-handlers/synchronize';\nimport editedHandler from './pr-handlers/edited';\nimport labelsChanged from './pr-handlers/labelsChanged';\nimport checkrunCompleted from './pr-handlers/checkrunCompleted';\nimport checksuiteCompleted from './pr-handlers/checksuiteCompleted';\nimport status from './pr-handlers/status';\n\nif (!process.env.NAME) process.env.NAME = 'reviewflow';\n\n// const getConfig = require('probot-config')\n// const { MongoClient } = require('mongodb');\n\n// const connect = MongoClient.connect(process.env.MONGO_URL);\n// const db = connect.then(client => client.db(process.env.MONGO_DB));\n\n// let config = await getConfig(context, 'reviewflow.yml');\n\n// eslint-disable-next-line import/no-commonjs\nProbot.run((app: Application) => {\n openedHandler(app);\n closedHandler(app);\n reviewRequestedHandler(app);\n reviewRequestRemovedHandler(app);\n\n // app.on('pull_request.closed', async context => {\n\n // });\n\n // app.on('pull_request.reopened', async context => {\n\n // });\n\n reviewSubmittedHandler(app);\n reviewDismissedHandler(app);\n labelsChanged(app);\n synchromizeHandler(app);\n editedHandler(app);\n\n checkrunCompleted(app);\n checksuiteCompleted(app);\n status(app);\n});\n"],"names":["config","slackToken","process","env","ORNIKAR_SLACK_TOKEN","autoAssignToCreator","trimTitle","requiresReviewRequest","prDefaultOptions","featureBranch","autoMerge","deleteAfterMerge","parsePR","title","regExp","error","summary","bot","status","statusInfoFromMatch","match","issue","inBody","url","groups","dev","abarreir","ORNIKAR_EMAIL_DOMAIN","arthurflachs","CorentinAndre","rigma","damienorny","darame07","Pixy","christophehurpeau","HugoGarrido","LentnerStefan","Mxime","tilap","design","jperriere","CoralineColasse","waitForGroups","labels","list","name","color","review","ci","inProgress","succeeded","failed","needsReview","requested","changesRequested","approved","teamConfigs","ornikar","options","optionsRegexps","map","option","regexp","RegExp","optionsLabels","label","commentStart","commentEnd","regexpCols","regexpReviewflowCol","parseOptions","content","defaultConfig","reduce","acc","exec","parseBody","description","reviewFlowCol","reviewflowContent","reviewFlowColMatch","reviewflowContentCol","reviewflowContentColPrefix","reviewflowContentColSuffix","hasFailedStatusOrChecks","context","repoContext","pr","checks","github","listForRef","repo","ref","head","sha","per_page","failedChecks","data","check_runs","filter","check","conclusion","length","log","info","id","combinedStatus","repos","getCombinedStatusForRef","state","failedStatuses","statuses","autoMergeIfPossible","payload","pull_request","prLabels","autoMergeLabel","createMergeLockPrFromPr","number","branch","find","l","debug","removeMergeLockedPr","hasNeedsReview","hasRequestedReview","lockedPr","getMergeLockedPr","pushAutomergeQueue","addMergeLockPr","mergeable","undefined","prResult","pulls","get","pull_number","merged","mergeable_state","reschedule","startsWith","issues","update","body","replace","base","merge","owner","login","parsedBody","mergeResult","merge_method","commit_title","commit_message","Boolean","err","message","initRepoLabels","listLabelsForRepo","finalLabels","labelKey","labelConfig","Object","entries","labelColor","slice","existingLabel","result","createLabel","current_name","updateLabel","getKeys","o","keys","ExcludesFalsy","initTeamSlack","mention","postMessage","Promise","resolve","githubLoginToSlackEmail","groupName","assign","slackClient","WebClient","allUsers","users","limit","members","values","email","member","user","profile","console","warn","im","open","channel","membersMap","Map","getUserFromGithubLogin","githubLogin","text","DRY_RUN","chat","initTeamContext","slackPromise","githubLoginToGroup","forEach","set","getReviewerGroups","githubLogins","Set","getReviewerGroup","reviewShouldWait","reviewerGroup","requestedReviewers","includesReviewerGroup","includesWaitForGroups","requestedReviewerGroups","request","includes","some","group","slack","teamContextsPromise","teamContexts","obtainTeamContext","repository","existingTeamContext","existingPromise","promise","then","teamContext","delete","initRepoContext","create","all","reviewGroupNames","needsReviewLabelIds","key","requestedReviewLabelIds","changesRequestedLabelIds","approvedReviewLabelIds","protectedLabelIds","labelIdToGroupName","reviewGroupLabels","lock","Lock","lockMergePr","automergeQueue","lockPROrPRS","prIdOrIds","callback","reject","createReleaseCallback","release","Error","setTimeout","String","hasChangesRequestedReview","hasApprovesReview","getNeedsReviewGroupNames","shift","p","push","repoContextsPromise","repoContexts","obtainRepoContext","NAME","existingRepoContext","handlerPullRequestChange","createHandlerPullRequestChange","createHandlerPullRequestsChange","getPullRequests","prs","autoAssignPRToCreator","assignees","type","addAssignees","cleanTitle","trim","s","arg1","toLowerCase","toMarkdownOptions","join","toMarkdownInfos","infos","updateBody","updateOptions","parsed","infosParagraph","updatedOptions","editOpenedPR","isPrFromBot","errorRule","rule","date","Date","toISOString","hasLintPrCheck","createStatus","target_url","head_sha","started_at","completed_at","output","featureBranchLabel","automergeLabel","prHasFeatureBranchLabel","prHasAutoMergeLabel","defaultOptions","hasDiffInTitle","hasDiffInBody","removeLabel","addLabels","addStatusCheck","hasPrCheck","created_at","createFailedStatusCheck","updateStatusCheckFromLabels","requested_reviewers","rr","needsReviewGroupNames","updateReviewStatus","reviewGroup","add","labelsToAdd","remove","labelsToRemove","newLabelNames","toAdd","toDelete","getLabelFromKey","reviewConfig","prLabel","existing","newLabelNamesArray","oldLabels","size","replaceLabels","autoApproveAndAutoMerge","codeApprovedLabel","createReview","event","opened","app","on","fromRenovate","closed","git","deleteRef","catch","reviewRequested","sender","reviewer","requested_reviewer","reviews","listReviews","hasChangesRequestedInReviews","html_url","reviewRequestRemoved","hasRequestedReviewsForGroup","hasApprovedInReviews","reviewSubmitted","newLabels","prUrl","reviewDismissed","synchronize","edited","labelsChanged","action","prBody","checkrunCompleted","check_run","pull_requests","checksuiteCompleted","check_suite","isSameBranch","branches","b","Probot","run","openedHandler","closedHandler","reviewRequestedHandler","reviewRequestRemovedHandler","reviewSubmittedHandler","reviewDismissedHandler","synchromizeHandler","editedHandler"],"mappings":";;;;;;;AAEA,MAAMA,MAAgC,GAAG;EACvCC,UAAU,EAAEC,OAAO,CAACC,GAAR,CAAYC,mBADe;EAEvCC,mBAAmB,EAAE,IAFkB;EAGvCC,SAAS,EAAE,IAH4B;EAIvCC,qBAAqB,EAAE,IAJgB;EAKvCC,gBAAgB,EAAE;IAChBC,aAAa,EAAE,KADC;IAEhBC,SAAS,EAAE,KAFK;IAGhBC,gBAAgB,EAAE;GARmB;EAUvCC,OAAO,EAAE;IACPC,KAAK,EAAE,CACL;MACEC,MAAM;gGADR;MAIEC,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B,GAAD,CAAnB;EACAzU,MAAM,CAACyU,GAAD,CAAN;CAtBF"} \ No newline at end of file diff --git a/dist/index-node10.cjs.js b/dist/index-node10.cjs.js index c689867e2..51003c9e2 100644 --- a/dist/index-node10.cjs.js +++ b/dist/index-node10.cjs.js @@ -12,6 +12,7 @@ const config = { requiresReviewRequest: true, prDefaultOptions: { featureBranch: false, + autoMerge: false, deleteAfterMerge: true }, parsePR: { @@ -161,6 +162,7 @@ const config$1 = { requiresReviewRequest: false, prDefaultOptions: { featureBranch: false, + autoMerge: false, deleteAfterMerge: true }, parsePR: { @@ -246,7 +248,7 @@ const teamConfigs = { // return Object.values(groups).flat(1); // }; -const options = ['featureBranch', 'deleteAfterMerge']; +const options = ['featureBranch', 'autoMerge', 'deleteAfterMerge']; const optionsRegexps = options.map(option => ({ name: option, regexp: new RegExp(`\\[([ xX]?)]\\s*`) @@ -254,6 +256,9 @@ const optionsRegexps = options.map(option => ({ const optionsLabels = [{ name: 'featureBranch', label: 'This PR is a feature branch' +}, { + name: 'autoMerge', + label: 'Auto merge when this PR is ready and has no failed statuses. (Also has a queue per repo to prevent multiple useless "Update branch" triggers)' }, { name: 'deleteAfterMerge', label: 'Automatic branch delete after this PR is merged' @@ -937,8 +942,11 @@ const editOpenedPR = async (context, repoContext) => { description: errorRule ? errorRule.error.title : '✓ Your PR is valid' }))].filter(ExcludesFalsy$3)); const featureBranchLabel = repoContext.labels['feature-branch']; + const automergeLabel = repoContext.labels['merge/automerge']; const prHasFeatureBranchLabel = Boolean(featureBranchLabel && pr.labels.find(label => label.id === featureBranchLabel.id)); + const prHasAutoMergeLabel = Boolean(automergeLabel && pr.labels.find(label => label.id === automergeLabel.id)); const defaultOptions = { ...repoContext.config.prDefaultOptions, + autoMerge: prHasAutoMergeLabel, featureBranch: prHasFeatureBranchLabel }; const { @@ -964,17 +972,33 @@ const editOpenedPR = async (context, repoContext) => { await context.github.issues.update(context.issue(update)); } - if (options && featureBranchLabel) { - if (prHasFeatureBranchLabel && !options.featureBranch) { - await context.github.issues.removeLabel(context.issue({ - name: featureBranchLabel.name - })); + if (options && (featureBranchLabel || automergeLabel)) { + if (featureBranchLabel) { + if (prHasFeatureBranchLabel && !options.featureBranch) { + await context.github.issues.removeLabel(context.issue({ + name: featureBranchLabel.name + })); + } + + if (options.featureBranch && !prHasFeatureBranchLabel) { + await context.github.issues.addLabels(context.issue({ + labels: [featureBranchLabel.name] + })); + } } - if (options.featureBranch && !prHasFeatureBranchLabel) { - await context.github.issues.addLabels(context.issue({ - labels: [featureBranchLabel.name] - })); + if (automergeLabel) { + if (prHasAutoMergeLabel && !options.autoMerge) { + await context.github.issues.removeLabel(context.issue({ + name: automergeLabel.name + })); + } + + if (options.autoMerge && !prHasAutoMergeLabel) { + await context.github.issues.addLabels(context.issue({ + labels: [automergeLabel.name] + })); + } } } }; @@ -1393,16 +1417,16 @@ function labelsChanged(app) { } await updateStatusCheckFromLabels(context, repoContext); + const featureBranchLabel = repoContext.labels['feature-branch']; + const automergeLabel = repoContext.labels['merge/automerge']; - if (repoContext.labels['feature-branch'] && label.id === repoContext.labels['feature-branch'].id) { + if (featureBranchLabel && label.id === automergeLabel.id || automergeLabel && label.id === automergeLabel.id) { + const option = featureBranchLabel && label.id === automergeLabel.id ? 'featureBranch' : 'autoMerge'; const prBody = context.payload.pull_request.body; const { body - } = updateBody(prBody, { - featureBranch: false, - deleteAfterMerge: false - }, undefined, { - featureBranch: context.payload.action === 'labeled' + } = updateBody(prBody, repoContext.config.prDefaultOptions, undefined, { + [option]: context.payload.action === 'labeled' }); if (body !== prBody) { diff --git a/dist/index-node10.cjs.js.map b/dist/index-node10.cjs.js.map index 1be7b1adf..9733c2086 100644 --- a/dist/index-node10.cjs.js.map +++ b/dist/index-node10.cjs.js.map @@ -1 +1 @@ -{"version":3,"file":"index-node10.cjs.js","sources":["../src/teamconfigs/ornikar.ts","../src/teamconfigs/christophehurpeau.ts","../src/teamconfigs/index.ts","../src/pr-handlers/actions/utils/prOptions.ts","../src/pr-handlers/actions/utils/parseBody.ts","../src/pr-handlers/actions/autoMergeIfPossible.ts","../src/context/initRepoLabels.ts","../src/context/utils.ts","../src/context/initTeamSlack.ts","../src/context/teamContext.ts","../src/context/repoContext.ts","../src/pr-handlers/utils.ts","../src/pr-handlers/actions/autoAssignPRToCreator.ts","../src/pr-handlers/actions/utils/cleanTitle.ts","../src/pr-handlers/actions/utils/updateBody.ts","../src/pr-handlers/actions/editOpenedPR.ts","../src/pr-handlers/actions/updateStatusCheckFromLabels.ts","../src/pr-handlers/actions/updateReviewStatus.ts","../src/pr-handlers/actions/autoApproveAndAutoMerge.ts","../src/pr-handlers/opened.ts","../src/pr-handlers/closed.ts","../src/pr-handlers/reviewRequested.ts","../src/pr-handlers/reviewRequestRemoved.ts","../src/pr-handlers/reviewSubmitted.ts","../src/pr-handlers/reviewDismissed.ts","../src/pr-handlers/synchronize.ts","../src/pr-handlers/edited.ts","../src/pr-handlers/labelsChanged.ts","../src/pr-handlers/checkrunCompleted.ts","../src/pr-handlers/checksuiteCompleted.ts","../src/pr-handlers/status.ts","../src/index.ts"],"sourcesContent":["import { Config } from './types';\n\nconst config: Config<'dev' | 'design'> = {\n slackToken: process.env.ORNIKAR_SLACK_TOKEN,\n autoAssignToCreator: true,\n trimTitle: true,\n requiresReviewRequest: true,\n prDefaultOptions: {\n featureBranch: false,\n deleteAfterMerge: true,\n },\n parsePR: {\n title: [\n {\n regExp:\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^(revert: )?(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\\(([a-z\\-/]*)\\))?:\\s/,\n error: {\n title: 'Title does not match commitlint conventional',\n summary:\n 'https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional',\n },\n },\n {\n bot: false,\n regExp: /\\s(ONK-(\\d+)|\\[no issue])$/,\n error: {\n title: 'Title does not have JIRA issue',\n summary: 'The PR title should end with ONK-0000, or [no issue]',\n },\n status: 'jira-issue',\n statusInfoFromMatch: (match) => {\n const issue = match[1];\n if (issue === '[no issue]') {\n return {\n title: 'No issue',\n summary: '',\n };\n }\n return {\n inBody: true,\n url: `https://ornikar.atlassian.net/browse/${issue}`,\n title: `JIRA issue: ${issue}`,\n summary: `[${issue}](https://ornikar.atlassian.net/browse/${issue})`,\n };\n },\n },\n ],\n },\n\n groups: {\n dev: {\n /* back */\n abarreir: `alexandre${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n arthurflachs: `arthur${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n CorentinAndre: `corentin${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n rigma: `romain${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n damienorny: `damien.orny${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n 'Thierry-girod': `thierry${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n darame07: `kevin${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n Pixy: `pierre-alexis${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n /* front */\n christophehurpeau: `christophe${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n HugoGarrido: `hugo${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n LentnerStefan: `stefan${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n Mxime: `maxime${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n tilap: `julien.lavinh${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n '63m29': `valerian${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n },\n design: {\n jperriere: `julien${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n CoralineColasse: `coraline${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n },\n },\n waitForGroups: {\n dev: [],\n design: ['dev'],\n },\n labels: {\n list: {\n // /* ci */\n // 'ci/in-progress': { name: ':green_heart: ci/in-progress', color: '#0052cc' },\n // 'ci/fail': { name: ':green_heart: ci/fail', color: '#e11d21' },\n // 'ci/passed': { name: ':green_heart: ci/passed', color: '#86f9b4' },\n\n /* code */\n 'code/needs-review': {\n name: ':ok_hand: code/needs-review',\n color: '#FFC44C',\n },\n 'code/review-requested': {\n name: ':ok_hand: code/review-requested',\n color: '#DAE1E6',\n },\n 'code/changes-requested': {\n name: ':ok_hand: code/changes-requested',\n color: '#e11d21',\n },\n 'code/approved': {\n name: ':ok_hand: code/approved',\n color: '#64DD17',\n },\n\n /* design */\n 'design/needs-review': {\n name: ':art: design/needs-review',\n color: '#FFC44C',\n },\n 'design/review-requested': {\n name: ':art: design/review-requested',\n color: '#DAE1E6',\n },\n 'design/changes-requested': {\n name: ':art: design/changes-requested',\n color: '#e11d21',\n },\n 'design/approved': {\n name: ':art: design/approved',\n color: '#64DD17',\n },\n\n /* auto merge */\n 'merge/automerge': {\n name: ':soon: automerge',\n color: '#64DD17',\n },\n\n /* feature-branch */\n 'feature-branch': {\n name: 'feature-branch',\n color: '#7FCEFF',\n },\n },\n\n review: {\n ci: {\n inProgress: 'ci/in-progress',\n succeeded: 'ci/success',\n failed: 'ci/fail',\n },\n dev: {\n needsReview: 'code/needs-review',\n requested: 'code/review-requested',\n changesRequested: 'code/changes-requested',\n approved: 'code/approved',\n },\n design: {\n needsReview: 'design/needs-review',\n requested: 'design/review-requested',\n changesRequested: 'design/changes-requested',\n approved: 'design/approved',\n },\n },\n },\n};\n\nexport default config;\n","import { Config } from './types';\n\nconst config: Config<'dev'> = {\n autoAssignToCreator: true,\n trimTitle: true,\n requiresReviewRequest: false,\n prDefaultOptions: {\n featureBranch: false,\n deleteAfterMerge: true,\n },\n parsePR: {\n title: [\n {\n regExp:\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^(revert: )?(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\\(([a-z\\-/]*)\\))?:\\s/,\n error: {\n title: 'Title does not match commitlint conventional',\n summary:\n 'https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional',\n },\n },\n ],\n },\n groups: {\n dev: {\n christophehurpeau: 'christophe@hurpeau.com',\n 'chris-reviewflow': 'christophe.hurpeau+reviewflow@gmail.com',\n tilap: 'jlavinh@gmail.com',\n },\n },\n waitForGroups: {\n dev: [],\n },\n labels: {\n list: {\n // /* ci */\n // 'ci/in-progress': { name: ':green_heart: ci/in-progress', color: '#0052cc' },\n // 'ci/fail': { name: ':green_heart: ci/fail', color: '#e11d21' },\n // 'ci/passed': { name: ':green_heart: ci/passed', color: '#86f9b4' },\n\n /* code */\n 'code/needs-review': {\n name: ':ok_hand: code/needs-review',\n color: '#FFD57F',\n },\n 'code/review-requested': {\n name: ':ok_hand: code/review-requested',\n color: '#B2E1FF',\n },\n 'code/changes-requested': {\n name: ':ok_hand: code/changes-requested',\n color: '#e11d21',\n },\n 'code/approved': {\n name: ':ok_hand: code/approved',\n color: '#64DD17',\n },\n\n /* auto merge */\n 'merge/automerge': {\n name: ':soon: automerge',\n color: '#64DD17',\n },\n\n /* feature-branch */\n 'feature-branch': {\n name: 'feature-branch',\n color: '#7FCEFF',\n },\n },\n\n review: {\n ci: {\n inProgress: 'ci/in-progress',\n succeeded: 'ci/success',\n failed: 'ci/fail',\n },\n dev: {\n needsReview: 'code/needs-review',\n requested: 'code/review-requested',\n changesRequested: 'code/changes-requested',\n approved: 'code/approved',\n },\n },\n },\n};\n\nexport default config;\n","import { Config as ConfigType } from './types';\nimport ornikar from './ornikar';\nimport christophehurpeau from './christophehurpeau';\n\nexport type Config = ConfigType;\n\nexport const teamConfigs: { [owner: string]: Config } = {\n ornikar,\n christophehurpeau,\n};\n\n// flat requires node 11\n// export const getMembers = (\n// groups: Record,\n// ): string[] => {\n// return Object.values(groups).flat(1);\n// };\n","export type Options = 'featureBranch' | 'deleteAfterMerge';\n\nexport const options: Options[] = ['featureBranch', 'deleteAfterMerge'];\nexport const optionsRegexps: { name: Options; regexp: RegExp }[] = options.map(\n (option) => ({\n name: option,\n regexp: new RegExp(`\\\\[([ xX]?)]\\\\s*`),\n }),\n);\n\nexport const optionsLabels: { name: Options; label: string }[] = [\n { name: 'featureBranch', label: 'This PR is a feature branch' },\n {\n name: 'deleteAfterMerge',\n label: 'Automatic branch delete after this PR is merged',\n },\n];\n","import { Options, optionsRegexps } from './prOptions';\n\nconst commentStart = '';\nconst commentEnd = \"\";\n\nconst regexpCols = /^(.*)((.*)).*$/is;\nconst regexpReviewflowCol = /^(\\s*<\\/td>]*>)\\s*(.*)\\s*(<\\/td><\\/tr><\\/table>\\s*)\\s*$/is;\n\nconst parseOptions = (\n content: string,\n defaultConfig: Record,\n): Record => {\n return optionsRegexps.reduce(\n (acc, { name, regexp }) => {\n const match = regexp.exec(content);\n acc[name] = !match\n ? defaultConfig[name] || false\n : match[1] === 'x' || match[1] === 'X';\n return acc;\n },\n {} as any,\n ) as Record;\n};\n\nexport const parseBody = (\n description: string,\n defaultConfig: Record,\n) => {\n const match = regexpCols.exec(description);\n if (!match) return null;\n const [, content, reviewFlowCol, reviewflowContent] = match;\n const reviewFlowColMatch = regexpReviewflowCol.exec(reviewFlowCol);\n if (!reviewFlowColMatch) {\n return {\n content,\n reviewflowContentCol: reviewflowContent,\n reviewflowContentColPrefix: commentStart,\n reviewflowContentColSuffix: commentEnd,\n options: parseOptions(reviewFlowCol, defaultConfig),\n };\n }\n const [\n ,\n reviewflowContentColPrefix,\n reviewflowContentCol,\n reviewflowContentColSuffix,\n ] = reviewFlowColMatch;\n\n return {\n content,\n reviewflowContentCol,\n reviewflowContentColPrefix,\n reviewflowContentColSuffix,\n options: parseOptions(reviewflowContentCol, defaultConfig),\n };\n};\n","/* eslint-disable max-lines */\nimport { Context } from 'probot';\n// eslint-disable-next-line import/no-cycle\nimport { RepoContext } from '../../context/repoContext';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { parseBody } from './utils/parseBody';\n\nconst hasFailedStatusOrChecks = async (\n context: Context,\n repoContext: RepoContext,\n pr: any,\n) => {\n const checks = await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n per_page: 100,\n }),\n );\n\n const failedChecks = checks.data.check_runs.filter(\n (check) => check.conclusion === 'failure',\n );\n\n if (failedChecks.length !== 0) {\n context.log.info(`automerge not possible: failed check pr ${pr.id}`, {\n checks: failedChecks.map((check) => check.name),\n });\n return true;\n }\n\n const combinedStatus = await context.github.repos.getCombinedStatusForRef(\n context.repo({\n ref: pr.head.sha,\n per_page: 100,\n }),\n );\n\n if (combinedStatus.data.state === 'failure') {\n const failedStatuses = combinedStatus.data.statuses.filter(\n (status) => status.state === 'failure' || status.state === 'error',\n );\n\n context.log.info(`automerge not possible: failed status pr ${pr.id}`, {\n statuses: failedStatuses.map((status) => status.context),\n });\n\n return true;\n }\n\n return false;\n};\n\nexport const autoMergeIfPossible = async (\n context: Context,\n repoContext: RepoContext,\n pr: any = context.payload.pull_request,\n prLabels: LabelResponse[] = pr.labels,\n): Promise => {\n const autoMergeLabel = repoContext.labels['merge/automerge'];\n if (!autoMergeLabel) return false;\n\n const createMergeLockPrFromPr = () => ({\n id: pr.id,\n number: pr.number,\n branch: pr.head.ref,\n });\n\n if (!prLabels.find((l): boolean => l.id === autoMergeLabel.id)) {\n context.log.debug('automerge not possible: no label');\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n }\n\n if (\n repoContext.hasNeedsReview(prLabels) ||\n repoContext.hasRequestedReview(prLabels)\n ) {\n context.log.debug('automerge not possible: blocking labels');\n // repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n }\n\n const lockedPr = repoContext.getMergeLockedPr();\n if (lockedPr && lockedPr.number !== pr.number) {\n context.log.info(`automerge not possible: locked pr ${pr.id}`);\n repoContext.pushAutomergeQueue(createMergeLockPrFromPr());\n return false;\n }\n\n repoContext.addMergeLockPr(createMergeLockPrFromPr());\n\n if (pr.mergeable === undefined) {\n const prResult = await context.github.pulls.get(\n context.repo({\n pull_number: pr.number,\n }),\n );\n pr = prResult.data;\n }\n\n if (pr.merged) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n context.log.info(`automerge not possible: already merged pr ${pr.id}`);\n return false;\n }\n\n context.log.info(\n `automerge?: ${pr.id}, mergeable=${pr.mergeable} state=${\n pr.mergeable_state\n }`,\n );\n\n // https://github.com/octokit/octokit.net/issues/1763\n if (\n !(\n pr.mergeable_state === 'clean' ||\n pr.mergeable_state === 'has_hooks' ||\n pr.mergeable_state === 'unstable'\n )\n ) {\n if (!pr.mergeable_state || pr.mergeable_state === 'unknown') {\n context.log.info(`automerge not possible: rescheduling ${pr.id}`);\n // GitHub is determining whether the pull request is mergeable\n repoContext.reschedule(context, createMergeLockPrFromPr());\n return false;\n }\n\n if (pr.head.ref.startsWith('renovate/')) {\n if (pr.mergeable_state === 'behind' || pr.mergeable_state === 'dirty') {\n context.log.info(\n `automerge not possible: rebase renovate branch pr ${pr.id}`,\n );\n // TODO check if has commits not made by renovate https://github.com/ornikar/shared-configs/pull/47#issuecomment-445767120\n\n await context.github.issues.update(\n context.repo({\n number: pr.number,\n body: pr.body.replace(\n '[ ] ',\n '[x] ',\n ),\n }),\n );\n return false;\n }\n\n if (await hasFailedStatusOrChecks(context, repoContext, pr)) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n } else if (pr.mergeable_state === 'blocked') {\n // waiting for reschedule in status (pr-handler/status.ts)\n return false;\n }\n\n context.log.info(\n `automerge not possible: renovate with mergeable_state=${\n pr.mergeable_state\n }`,\n );\n return false;\n }\n\n if (pr.mergeable_state === 'blocked') {\n if (await hasFailedStatusOrChecks(context, repoContext, pr)) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n } else {\n // waiting for reschedule in status (pr-handler/status.ts)\n return false;\n }\n }\n\n if (pr.mergeable_state === 'behind') {\n context.log.info('automerge not possible: update branch', {\n head: pr.head.ref,\n base: pr.base.ref,\n });\n\n await context.github.repos.merge({\n owner: pr.head.repo.owner.login,\n repo: pr.head.repo.name,\n head: pr.base.ref,\n base: pr.head.ref,\n });\n\n return false;\n }\n\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n context.log.info(\n `automerge not possible: not mergeable mergeable_state=${\n pr.mergeable_state\n }`,\n );\n return false;\n }\n\n try {\n context.log.info(`automerge pr #${pr.number}`);\n const parsedBody = parseBody(pr.body, repoContext.config.prDefaultOptions);\n const mergeResult = await context.github.pulls.merge({\n merge_method:\n parsedBody && parsedBody.options.featureBranch ? 'merge' : 'squash',\n owner: pr.head.repo.owner.login,\n repo: pr.head.repo.name,\n pull_number: pr.number,\n commit_title: `${pr.title} (#${pr.number})`,\n commit_message: '', // TODO add BC\n });\n context.log.debug('merge result:', mergeResult.data);\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return Boolean(mergeResult.data.merged);\n } catch (err) {\n context.log.info('could not merge:', err.message);\n repoContext.reschedule(context, createMergeLockPrFromPr());\n return false;\n }\n};\n","import { Context } from 'probot';\nimport { Config } from '../teamconfigs';\n\nexport interface LabelResponse {\n id: number;\n node_id: string;\n url: string;\n name: string;\n description: string;\n color: string;\n default: boolean;\n}\n\nexport interface Labels {\n [key: string]: LabelResponse;\n}\n\nexport const initRepoLabels = async (\n context: Context,\n config: Config,\n): Promise => {\n const { data: labels } = await context.github.issues.listLabelsForRepo(\n context.repo({ per_page: 100 }),\n );\n const finalLabels: Record = {};\n\n for (const [labelKey, labelConfig] of Object.entries(config.labels.list)) {\n const labelColor = labelConfig.color.slice(1);\n const description = `Generated by review-flow for ${labelKey}`;\n\n let existingLabel = labels.find((label) => label.name === labelConfig.name);\n if (!existingLabel) {\n existingLabel = labels.find((label) => label.description === description);\n }\n if (!existingLabel) {\n if (labelKey === 'design/needs-review') {\n existingLabel = labels.find(\n (label) => label.name === 'needs-design-review',\n );\n }\n if (labelKey === 'design/approved') {\n existingLabel = labels.find(\n (label) => label.name === 'design-reviewed',\n );\n }\n }\n\n if (!existingLabel) {\n const result = await context.github.issues.createLabel(\n context.repo({\n name: labelConfig.name,\n color: labelColor,\n description,\n }),\n );\n finalLabels[labelKey] = result.data;\n } else if (\n existingLabel.name !== labelConfig.name ||\n existingLabel.color !== labelColor // ||\n // TODO: description is never updated\n // existingLabel.description !== description\n ) {\n context.log.info('Needs to update label', {\n current_name: existingLabel.name,\n name: existingLabel.name !== labelConfig.name && labelConfig.name,\n color: existingLabel.color !== labelColor && labelColor,\n description: existingLabel.description !== description && description,\n });\n\n const result = await context.github.issues.updateLabel(\n context.repo({\n current_name: existingLabel.name,\n name: labelConfig.name,\n color: labelColor,\n description,\n }),\n );\n finalLabels[labelKey] = result.data;\n } else {\n finalLabels[labelKey] = existingLabel;\n }\n }\n\n return finalLabels;\n};\n","export const getKeys = (o: T): (keyof T)[] =>\n Object.keys(o) as (keyof T)[];\n","import { WebClient } from '@slack/web-api';\nimport { Context } from 'probot';\nimport { Config } from '../teamconfigs';\nimport { getKeys } from './utils';\n\nexport interface TeamSlack {\n mention: (githubLogin: string) => string;\n postMessage: (githubLogin: string, text: string) => Promise;\n}\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport const initTeamSlack = async (\n context: Context,\n config: Config,\n): Promise => {\n if (!config.slackToken) {\n return {\n mention: (githubLogin: string) => '',\n postMessage: (githubLogin: string, text: string) => Promise.resolve(),\n };\n }\n\n const githubLoginToSlackEmail = getKeys(config.groups).reduce<{\n [login: string]: string;\n }>((acc, groupName) => {\n Object.assign(acc, config.groups[groupName]);\n return acc;\n }, {});\n\n const slackClient = new WebClient(config.slackToken);\n const allUsers: any = await slackClient.users.list({ limit: 200 });\n const members: [string, { member: any; im: any }][] = Object.values(\n githubLoginToSlackEmail,\n )\n .map((email) => {\n const member = allUsers.members.find(\n (user: any) => user.profile.email === email,\n );\n if (!member) {\n console.warn(`Could not find user ${email}`);\n return;\n }\n return [email, { member, im: undefined }] as [\n string,\n { member: any; im: any }\n ];\n })\n .filter(ExcludesFalsy);\n\n for (const [, user] of members) {\n try {\n const im: any = await slackClient.im.open({ user: user.member.id });\n user.im = im.channel;\n } catch (err) {\n console.error(err);\n }\n }\n\n const membersMap = new Map(members);\n\n const getUserFromGithubLogin = (githubLogin: string) => {\n const email = githubLoginToSlackEmail[githubLogin];\n if (!email) return null;\n return membersMap.get(email);\n };\n\n return {\n mention: (githubLogin: string) => {\n const user = getUserFromGithubLogin(githubLogin);\n if (!user) return githubLogin;\n return `<@${user.member.id}>`;\n },\n postMessage: async (githubLogin: string, text: string) => {\n context.log.info('send slack', { githubLogin, text });\n if (process.env.DRY_RUN) return;\n\n const user = getUserFromGithubLogin(githubLogin);\n if (!user || !user.im) return;\n await slackClient.chat.postMessage({\n channel: user.im.id,\n text,\n });\n },\n };\n};\n","import { Context } from 'probot';\nimport { Config } from '../teamconfigs';\nimport { initTeamSlack, TeamSlack } from './initTeamSlack';\nimport { getKeys } from './utils';\n\nexport interface TeamContext {\n config: Config;\n slack: TeamSlack;\n getReviewerGroup: (githubLogin: string) => string | undefined;\n getReviewerGroups: (githubLogins: string[]) => string[];\n reviewShouldWait: (\n reviewerGroup: GroupNames | undefined,\n requestedReviewers: any[],\n {\n includesReviewerGroup,\n includesWaitForGroups,\n }: { includesReviewerGroup?: boolean; includesWaitForGroups?: boolean },\n ) => boolean;\n}\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nconst initTeamContext = async (\n context: Context,\n config: Config,\n): Promise => {\n const slackPromise = initTeamSlack(context, config);\n\n const githubLoginToGroup = getKeys(config.groups).reduce>(\n (acc, groupName) => {\n Object.keys(config.groups[groupName]).forEach((login) => {\n acc.set(login, groupName);\n });\n return acc;\n },\n new Map(),\n );\n\n const getReviewerGroups = (githubLogins: string[]) => [\n ...new Set(\n githubLogins\n .map((githubLogin) => githubLoginToGroup.get(githubLogin))\n .filter(Boolean),\n ),\n ];\n\n return {\n config,\n getReviewerGroup: (githubLogin) => githubLoginToGroup.get(githubLogin),\n getReviewerGroups: (githubLogins) => [\n ...new Set(\n githubLogins\n .map((githubLogin) => githubLoginToGroup.get(githubLogin))\n .filter(ExcludesFalsy),\n ),\n ],\n\n reviewShouldWait: (\n reviewerGroup,\n requestedReviewers,\n { includesReviewerGroup, includesWaitForGroups },\n ) => {\n if (!reviewerGroup) return false;\n\n const requestedReviewerGroups = getReviewerGroups(\n requestedReviewers.map((request) => request.login),\n );\n\n // contains another request of a reviewer in the same group\n if (\n includesReviewerGroup &&\n requestedReviewerGroups.includes(reviewerGroup)\n ) {\n return true;\n }\n\n // contains a request from a dependent group\n if (config.waitForGroups && includesWaitForGroups) {\n const waitForGroups = config.waitForGroups;\n return requestedReviewerGroups.some((group) =>\n waitForGroups[reviewerGroup].includes(group),\n );\n }\n\n return false;\n },\n\n slack: await slackPromise,\n };\n};\n\nconst teamContextsPromise = new Map();\nconst teamContexts = new Map();\n\nexport const obtainTeamContext = (\n context: Context,\n config: Config,\n): Promise => {\n const owner = context.payload.repository.owner;\n\n const existingTeamContext = teamContexts.get(owner.login);\n if (existingTeamContext) return existingTeamContext;\n\n const existingPromise = teamContextsPromise.get(owner.login);\n if (existingPromise) return Promise.resolve(existingPromise);\n\n const promise = initTeamContext(context, config);\n teamContextsPromise.set(owner.login, promise);\n\n return promise.then((teamContext) => {\n teamContextsPromise.delete(owner.login);\n teamContexts.set(owner.login, teamContext);\n return teamContext;\n });\n};\n","/* eslint-disable max-lines */\n\nimport { Lock } from 'lock';\nimport { Context } from 'probot';\nimport { teamConfigs, Config } from '../teamconfigs';\n// eslint-disable-next-line import/no-cycle\nimport { autoMergeIfPossible } from '../pr-handlers/actions/autoMergeIfPossible';\nimport { initRepoLabels, LabelResponse, Labels } from './initRepoLabels';\nimport { obtainTeamContext, TeamContext } from './teamContext';\n\nexport interface LockedMergePr {\n id: number;\n number: number;\n branch: string;\n}\n\ninterface RepoContextWithoutTeamContext {\n labels: Labels;\n protectedLabelIds: readonly LabelResponse['id'][];\n\n hasNeedsReview: (labels: LabelResponse[]) => boolean;\n hasRequestedReview: (labels: LabelResponse[]) => boolean;\n hasChangesRequestedReview: (labels: LabelResponse[]) => boolean;\n hasApprovesReview: (labels: LabelResponse[]) => boolean;\n getNeedsReviewGroupNames: (labels: LabelResponse[]) => GroupNames[];\n\n lockPROrPRS(\n prIdOrIds: string | string[],\n callback: () => Promise | void,\n ): Promise;\n\n getMergeLockedPr(): LockedMergePr;\n addMergeLockPr(pr: LockedMergePr): void;\n removeMergeLockedPr(context: Context, pr: LockedMergePr): void;\n reschedule(context: Context, pr: LockedMergePr): void;\n pushAutomergeQueue(pr: LockedMergePr): void;\n}\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport type RepoContext = TeamContext<\n GroupNames\n> &\n RepoContextWithoutTeamContext;\n\nasync function initRepoContext(\n context: Context,\n config: Config,\n): Promise> {\n const teamContext = await obtainTeamContext(context, config);\n const repoContext = Object.create(teamContext);\n\n const [labels] = await Promise.all([initRepoLabels(context, config)]);\n\n const reviewGroupNames = Object.keys(config.groups) as GroupNames[];\n\n const needsReviewLabelIds = reviewGroupNames\n .map((key: GroupNames) => config.labels.review[key].needsReview)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const requestedReviewLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].requested)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const changesRequestedLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].changesRequested)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const approvedReviewLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].approved)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const protectedLabelIds = [\n ...requestedReviewLabelIds,\n ...changesRequestedLabelIds,\n ...approvedReviewLabelIds,\n ];\n\n const labelIdToGroupName = new Map();\n reviewGroupNames.forEach((key) => {\n const reviewGroupLabels = config.labels.review[key] as any;\n Object.keys(reviewGroupLabels).forEach((labelKey: string) => {\n labelIdToGroupName.set(labels[reviewGroupLabels[labelKey]].id, key);\n });\n });\n\n // const updateStatusCheck = (context, reviewGroup, statusInfo) => {};\n\n const hasNeedsReview = (labels: LabelResponse[]) =>\n labels.some((label) => needsReviewLabelIds.includes(label.id));\n const hasRequestedReview = (labels: LabelResponse[]) =>\n labels.some((label) => requestedReviewLabelIds.includes(label.id));\n const hasChangesRequestedReview = (labels: LabelResponse[]) =>\n labels.some((label) => changesRequestedLabelIds.includes(label.id));\n const hasApprovesReview = (labels: LabelResponse[]) =>\n labels.some((label) => approvedReviewLabelIds.includes(label.id));\n\n const getNeedsReviewGroupNames = (labels: LabelResponse[]): GroupNames[] =>\n labels\n .filter((label) => needsReviewLabelIds.includes(label.id))\n .map((label) => labelIdToGroupName.get(label.id))\n .filter(ExcludesFalsy);\n\n const lock = Lock();\n let lockMergePr: LockedMergePr | undefined;\n const automergeQueue: LockedMergePr[] = [];\n\n const lockPROrPRS = (\n prIdOrIds: string | string[],\n callback: () => Promise | void,\n ): Promise =>\n new Promise((resolve, reject) => {\n console.log('lock: try to lock pr', { prIdOrIds });\n lock(prIdOrIds, async (createReleaseCallback) => {\n const release = createReleaseCallback(() => {});\n console.log('lock: lock acquired', { prIdOrIds });\n try {\n await callback();\n } catch (err) {\n console.log('lock: release pr (with error)', { prIdOrIds });\n release();\n reject(err);\n return;\n }\n console.log('lock: release pr', { prIdOrIds });\n release();\n resolve();\n });\n });\n\n const reschedule = (context: Context, pr: LockedMergePr) => {\n if (!pr) throw new Error('Cannot reschedule undefined');\n context.log.info('reschedule', pr);\n setTimeout(() => {\n lockPROrPRS('reschedule', () => {\n return lockPROrPRS(String(pr.id), async () => {\n const prResult = await context.github.pulls.get(\n context.repo({\n pull_number: pr.number,\n }),\n );\n await autoMergeIfPossible(context, repoContext, prResult.data);\n });\n });\n }, 1000);\n };\n\n return Object.assign(repoContext, {\n labels,\n protectedLabelIds,\n hasNeedsReview,\n hasRequestedReview,\n hasChangesRequestedReview,\n hasApprovesReview,\n getNeedsReviewGroupNames,\n\n getMergeLockedPr: () => lockMergePr,\n addMergeLockPr: (pr: LockedMergePr): void => {\n console.log('merge lock: lock', pr);\n if (lockMergePr && lockMergePr.number === pr.number) return;\n if (lockMergePr) throw new Error('Already have lock');\n lockMergePr = pr;\n },\n removeMergeLockedPr: (context, pr: LockedMergePr): void => {\n console.log('merge lock: remove', pr);\n if (!lockMergePr || lockMergePr.number !== pr.number) return;\n lockMergePr = automergeQueue.shift();\n console.log('merge lock: next', lockMergePr);\n if (lockMergePr) {\n reschedule(context, lockMergePr);\n }\n },\n pushAutomergeQueue: (pr: LockedMergePr): void => {\n console.log('merge lock: push queue', {\n pr,\n lockMergePr,\n automergeQueue,\n });\n if (!automergeQueue.some((p) => p.number === pr.number)) {\n automergeQueue.push(pr);\n }\n },\n reschedule,\n\n lockPROrPRS,\n } as RepoContextWithoutTeamContext);\n}\n\nconst repoContextsPromise = new Map>();\nconst repoContexts = new Map();\n\nexport const obtainRepoContext = (\n context: Context,\n): Promise | RepoContext | null => {\n const repo = context.payload.repository;\n if (\n repo.name === 'reviewflow-test' &&\n process.env.NAME !== 'reviewflow-test'\n ) {\n return null;\n }\n const owner = repo.owner;\n if (!teamConfigs[owner.login]) {\n console.warn(owner.login, Object.keys(teamConfigs));\n return null;\n }\n const key = repo.id;\n\n const existingRepoContext = repoContexts.get(key);\n if (existingRepoContext) return existingRepoContext;\n\n const existingPromise = repoContextsPromise.get(key);\n if (existingPromise) return Promise.resolve(existingPromise);\n\n const promise = initRepoContext(context, teamConfigs[owner.login]);\n repoContextsPromise.set(key, promise);\n\n return promise.then((repoContext) => {\n repoContextsPromise.delete(key);\n repoContexts.set(key, repoContext);\n return repoContext;\n });\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { obtainRepoContext, RepoContext } from '../context/repoContext';\n\nexport type Handler = (\n context: Context,\n repoContext: RepoContext,\n) => Promise;\n\nexport type CallbackWithRepoContext = (\n repoContext: RepoContext,\n) => void | Promise;\n\nexport const handlerPullRequestChange = async <\n T extends Webhooks.WebhookPayloadPullRequest\n>(\n context: Context,\n callback: CallbackWithRepoContext,\n): Promise => {\n const repoContext = await obtainRepoContext(context);\n if (!repoContext) return;\n\n repoContext.lockPROrPRS(String(context.payload.pull_request.id), async () => {\n await callback(repoContext);\n });\n};\n\ntype CallbackContextAndRepoContext = (\n context: Context,\n repoContext: RepoContext,\n) => void | Promise;\n\nexport const createHandlerPullRequestChange = <\n T extends Webhooks.WebhookPayloadPullRequest\n>(\n callback: CallbackContextAndRepoContext,\n) => (context: Context) => {\n return handlerPullRequestChange(context, (repoContext) =>\n callback(context, repoContext),\n );\n};\n\nexport const createHandlerPullRequestsChange = (\n getPullRequests: (\n context: Context,\n repoContext: RepoContext,\n ) => { id: string | number }[],\n callback: CallbackContextAndRepoContext,\n) => async (context: Context): Promise => {\n const repoContext = await obtainRepoContext(context);\n if (!repoContext) return;\n\n const prs = getPullRequests(context, repoContext);\n if (prs.length === 0) return;\n return repoContext.lockPROrPRS(prs.map((pr) => String(pr.id)), () =>\n callback(context, repoContext),\n );\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Handler } from '../utils';\n\nexport const autoAssignPRToCreator: Handler<\n Webhooks.WebhookPayloadPullRequest\n> = async (context, repoContext) => {\n if (!repoContext.config.autoAssignToCreator) return;\n\n const pr = context.payload.pull_request;\n if (pr.assignees.length !== 0) return;\n if (pr.user.type === 'Bot') return;\n\n await context.github.issues.addAssignees(\n context.issue({\n assignees: [pr.user.login],\n }),\n );\n};\n","export const cleanTitle = (title: string): string =>\n title\n .trim()\n .replace(/[\\s-]+\\[?\\s*ONK[- ](\\d+)\\s*]?\\s*$/i, ' ONK-$1')\n .replace(/^([A-Za-z]+)[/:]\\s*/, (s, arg1) => `${arg1.toLowerCase()}: `)\n .replace(/^Revert \"([^\"]+)\"$/, 'revert: $1')\n // eslint-disable-next-line unicorn/no-unsafe-regex\n .replace(/^(revert:.*)(\\s+\\(#\\d+\\))$/, '$1');\n","import { StatusInfo } from '../../../teamconfigs/types';\nimport { parseBody } from './parseBody';\nimport { Options, optionsLabels } from './prOptions';\n\nconst toMarkdownOptions = (options: Record) => {\n return optionsLabels\n .map(\n ({ name, label }) =>\n `- [${options[name] ? 'x' : ' '}] ${label}`,\n )\n .join('\\n');\n};\n\nconst toMarkdownInfos = (infos: StatusInfo[]) => {\n return infos\n .map((info) => {\n if (info.url) return `[${info.title}](${info.url})`;\n return info.title;\n })\n .join('\\n');\n};\n\ninterface UpdatedBodyWithOptions {\n body: string;\n options?: Record;\n}\n\nexport const updateBody = (\n body: string,\n defaultConfig: Record,\n infos?: StatusInfo[],\n updateOptions?: Partial>,\n): UpdatedBodyWithOptions => {\n const parsed = parseBody(body, defaultConfig);\n if (!parsed) {\n console.info('could not parse body');\n return { body };\n }\n const {\n content,\n reviewflowContentCol,\n reviewflowContentColPrefix,\n reviewflowContentColSuffix,\n options,\n } = parsed;\n\n // eslint-disable-next-line no-nested-ternary\n const infosParagraph = !infos\n ? reviewflowContentCol.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^\\s*(?:(#### Infos:.*)?#### Options:)?.*$/s,\n '$1',\n )\n : infos.length !== 0\n ? `#### Infos:\\n${toMarkdownInfos(infos)}\\n`\n : '';\n\n const updatedOptions = !updateOptions\n ? options\n : { ...options, ...updateOptions };\n\n return {\n options: updatedOptions,\n body: `${content}${reviewflowContentColPrefix}\n${infosParagraph}#### Options:\n${toMarkdownOptions(updatedOptions)}\n${reviewflowContentColSuffix}\n`,\n };\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { RepoContext } from '../../context/repoContext';\nimport { StatusError, StatusInfo } from '../../teamconfigs/types';\nimport { cleanTitle } from './utils/cleanTitle';\nimport { updateBody } from './utils/updateBody';\n\ninterface StatusWithInfo {\n name: string;\n info: StatusInfo;\n error?: undefined;\n}\n\ninterface StatusWithError {\n name: string;\n error: StatusError;\n info?: undefined;\n}\n\ntype Status = StatusWithInfo | StatusWithError;\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport const editOpenedPR = async (\n context: Context,\n repoContext: RepoContext,\n): Promise => {\n const repo = context.payload.repository;\n const pr = context.payload.pull_request;\n\n // do not lint pr from forks\n if (pr.head.repo.id !== repo.id) return;\n\n const title = repoContext.config.trimTitle ? cleanTitle(pr.title) : pr.title;\n\n const isPrFromBot = pr.user.type === 'Bot';\n\n const statuses: Status[] = [];\n\n const errorRule = repoContext.config.parsePR.title.find((rule) => {\n if (rule.bot === false && isPrFromBot) return false;\n\n const match = rule.regExp.exec(pr.title);\n if (match === null) {\n if (rule.status) {\n statuses.push({ name: rule.status, error: rule.error });\n }\n return true;\n }\n\n if (rule.status && rule.statusInfoFromMatch) {\n statuses.push({\n name: rule.status,\n info: rule.statusInfoFromMatch(match),\n });\n return false;\n }\n\n return false;\n });\n\n const date = new Date().toISOString();\n\n const hasLintPrCheck = (await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n }),\n )).data.check_runs.find(\n (check) => check.name === `${process.env.NAME}/lint-pr`,\n );\n\n await Promise.all(\n [\n ...statuses.map(({ name, error, info }) =>\n context.github.repos.createStatus(\n context.repo({\n context: `${process.env.NAME}/${name}`,\n sha: pr.head.sha,\n state: (error ? 'failure' : 'success') as 'failure' | 'success',\n target_url: error ? undefined : (info as StatusInfo).url,\n description: error ? error.title : (info as StatusInfo).title,\n }),\n ),\n ),\n hasLintPrCheck &&\n context.github.checks.create(\n context.repo({\n name: `${process.env.NAME}/lint-pr`,\n head_sha: pr.head.sha,\n status: 'completed' as 'completed',\n conclusion: (errorRule ? 'failure' : 'success') as\n | 'failure'\n | 'success',\n started_at: date,\n completed_at: date,\n output: errorRule\n ? errorRule.error\n : {\n title: '✓ Your PR is valid',\n summary: '',\n },\n }),\n ),\n !hasLintPrCheck &&\n context.github.repos.createStatus(\n context.repo({\n context: `${process.env.NAME}/lint-pr`,\n sha: pr.head.sha,\n state: (errorRule ? 'failure' : 'success') as 'failure' | 'success',\n target_url: undefined,\n description: errorRule\n ? errorRule.error.title\n : '✓ Your PR is valid',\n }),\n ),\n ].filter(ExcludesFalsy),\n );\n\n const featureBranchLabel = repoContext.labels['feature-branch'];\n const prHasFeatureBranchLabel = Boolean(\n featureBranchLabel &&\n pr.labels.find((label): boolean => label.id === featureBranchLabel.id),\n );\n const defaultOptions = {\n ...repoContext.config.prDefaultOptions,\n featureBranch: prHasFeatureBranchLabel,\n };\n\n const { body, options } = updateBody(pr.body, defaultOptions, statuses\n .filter((status) => status.info && status.info.inBody)\n .map((status) => status.info) as StatusInfo[]);\n\n const hasDiffInTitle = pr.title !== title;\n const hasDiffInBody = pr.body !== body;\n if (hasDiffInTitle || hasDiffInBody) {\n const update: Partial> = {};\n if (hasDiffInTitle) {\n update.title = title;\n pr.title = title;\n }\n if (hasDiffInBody) {\n update.body = body;\n pr.body = body;\n }\n\n await context.github.issues.update(context.issue(update));\n }\n\n if (options && featureBranchLabel) {\n if (prHasFeatureBranchLabel && !options.featureBranch) {\n await context.github.issues.removeLabel(\n context.issue({ name: featureBranchLabel.name }),\n );\n }\n\n if (options.featureBranch && !prHasFeatureBranchLabel) {\n await context.github.issues.addLabels(\n context.issue({ labels: [featureBranchLabel.name] }),\n );\n }\n }\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { RepoContext } from '../../context/repoContext';\n\nconst addStatusCheck = async function<\n E extends Webhooks.WebhookPayloadPullRequest\n>(\n context: Context,\n pr: any,\n { state, description }: { state: 'failure' | 'success'; description: string },\n): Promise {\n const hasPrCheck = (await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n }),\n )).data.check_runs.find((check) => check.name === process.env.NAME);\n\n context.log.info('add status check', { hasPrCheck, state, description });\n\n if (hasPrCheck) {\n await context.github.checks.create(\n context.repo({\n name: process.env.NAME as string,\n head_sha: pr.head.sha,\n started_at: pr.created_at,\n status: 'completed',\n conclusion: state,\n completed_at: new Date().toISOString(),\n output: {\n title: description,\n summary: '',\n },\n }),\n );\n } else {\n await context.github.repos.createStatus(\n context.repo({\n context: process.env.NAME,\n sha: pr.head.sha,\n state,\n target_url: undefined,\n description,\n }),\n );\n }\n};\n\nconst createFailedStatusCheck = (\n context: Context,\n pr: any,\n description: string,\n): Promise =>\n addStatusCheck(context, pr, {\n state: 'failure',\n description,\n });\n\nexport const updateStatusCheckFromLabels = (\n context: Context,\n repoContext: RepoContext,\n pr: any = context.payload.pull_request,\n labels: LabelResponse[] = pr.labels || [],\n): Promise => {\n context.log.info('updateStatusCheckFromLabels', {\n labels: labels.map((l) => l && l.name),\n hasNeedsReview: repoContext.hasNeedsReview(labels),\n hasApprovesReview: repoContext.hasApprovesReview(labels),\n });\n\n if (pr.requested_reviewers.length !== 0) {\n return createFailedStatusCheck(\n context,\n pr,\n `Awaiting review from: ${pr.requested_reviewers\n .map((rr: any) => rr.login)\n .join(', ')}`,\n );\n }\n\n if (repoContext.hasChangesRequestedReview(labels)) {\n return createFailedStatusCheck(\n context,\n pr,\n 'Changes requested ! Push commits or discuss changes then re-request a review.',\n );\n }\n\n const needsReviewGroupNames = repoContext.getNeedsReviewGroupNames(labels);\n\n if (needsReviewGroupNames.length !== 0) {\n return createFailedStatusCheck(\n context,\n pr,\n `Awaiting review from: ${needsReviewGroupNames.join(\n ', ',\n )}. Perhaps request someone ?`,\n );\n }\n\n if (!repoContext.hasApprovesReview(labels)) {\n if (\n repoContext.config.requiresReviewRequest &&\n !pr.head.ref.startsWith('renovate/')\n ) {\n return createFailedStatusCheck(\n context,\n pr,\n 'Awaiting review... Perhaps request someone ?',\n );\n }\n }\n\n // if (\n // repoContext.config.requiresReviewRequest &&\n // !repoContext.hasRequestedReview(labels)\n // ) {\n // return createFailedStatusCheck(\n // context,\n // pr,\n // 'You need to request someone to review the PR',\n // );\n // return;\n // }\n // return createInProgressStatusCheck(context);\n // } else if (repoContext.hasApprovesReview(labels)) {\n return addStatusCheck(context, pr, {\n state: 'success',\n description: '✓ PR ready to merge !',\n });\n // }\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { GroupLabels } from '../../teamconfigs/types';\nimport { RepoContext } from '../../context/repoContext';\nimport { updateStatusCheckFromLabels } from './updateStatusCheckFromLabels';\n\nexport const updateReviewStatus = async <\n E extends Webhooks.WebhookPayloadPullRequest,\n GroupNames extends string = any\n>(\n context: Context,\n repoContext: RepoContext,\n reviewGroup: GroupNames,\n {\n add: labelsToAdd,\n remove: labelsToRemove,\n }: {\n add?: (GroupLabels | false | undefined)[];\n remove?: (GroupLabels | false | undefined)[];\n },\n): Promise => {\n context.log.info('updateReviewStatus', {\n reviewGroup,\n labelsToAdd,\n labelsToRemove,\n });\n\n const pr = context.payload.pull_request;\n let prLabels = pr.labels || [];\n if (!reviewGroup) return prLabels;\n\n const newLabelNames = new Set(\n prLabels.map((label: LabelResponse) => label.name),\n );\n\n const toAdd = new Set();\n const toDelete = new Set();\n const labels = repoContext.labels;\n\n const getLabelFromKey = (key: GroupLabels): undefined | LabelResponse => {\n const reviewConfig = repoContext.config.labels.review[reviewGroup];\n if (!reviewConfig) return undefined;\n\n return reviewConfig[key] && labels[reviewConfig[key]]\n ? labels[reviewConfig[key]]\n : undefined;\n };\n\n if (labelsToAdd) {\n labelsToAdd.forEach((key) => {\n if (!key) return;\n const label = getLabelFromKey(key);\n if (\n !label ||\n prLabels.some((prLabel: LabelResponse) => prLabel.id === label.id)\n ) {\n return;\n }\n newLabelNames.add(label.name);\n toAdd.add(key);\n });\n }\n\n if (labelsToRemove) {\n labelsToRemove.forEach((key) => {\n if (!key) return;\n const label = getLabelFromKey(key);\n if (!label) return;\n const existing = prLabels.find(\n (prLabel: LabelResponse) => prLabel.id === label.id,\n );\n if (existing) {\n newLabelNames.delete(existing.name);\n toDelete.add(key);\n }\n });\n }\n\n const newLabelNamesArray = [...newLabelNames];\n\n context.log.info('updateReviewStatus', {\n reviewGroup,\n toAdd: [...toAdd],\n toDelete: [...toDelete],\n oldLabels: prLabels.map((l: LabelResponse) => l.name),\n newLabelNames: newLabelNamesArray,\n });\n\n // if (process.env.DRY_RUN) return;\n\n if (toAdd.size || toDelete.size) {\n const result = await context.github.issues.replaceLabels(\n context.issue({\n labels: newLabelNamesArray,\n }),\n );\n prLabels = result.data;\n }\n\n // if (toAdd.has('needsReview')) {\n // createInProgressStatusCheck(context);\n // } else if (\n // toDelete.has('needsReview') ||\n // (prLabels.length === 0 && toAdd.size === 1 && toAdd.has('approved'))\n // ) {\n await updateStatusCheckFromLabels(context, repoContext, pr, prLabels);\n // }\n\n return prLabels;\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { RepoContext } from '../../context/repoContext';\nimport { autoMergeIfPossible } from './autoMergeIfPossible';\n\nexport const autoApproveAndAutoMerge = async (\n context: Context,\n repoContext: RepoContext,\n): Promise => {\n // const autoMergeLabel = repoContext.labels['merge/automerge'];\n const codeApprovedLabel = repoContext.labels['code/approved'];\n const prLabels = context.payload.pull_request.labels;\n if (prLabels.find((l): boolean => l.id === codeApprovedLabel.id)) {\n await context.github.pulls.createReview(\n context.issue({ event: 'APPROVE' }),\n );\n }\n\n await autoMergeIfPossible(context, repoContext);\n};\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoAssignPRToCreator } from './actions/autoAssignPRToCreator';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\nimport { autoApproveAndAutoMerge } from './actions/autoApproveAndAutoMerge';\n\nexport default function opened(app: Application): void {\n app.on(\n 'pull_request.opened',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const fromRenovate = context.payload.pull_request.head.ref.startsWith(\n 'renovate/',\n );\n\n await Promise.all([\n autoAssignPRToCreator(context, repoContext),\n editOpenedPR(context, repoContext),\n fromRenovate\n ? autoApproveAndAutoMerge(context, repoContext)\n : updateReviewStatus(context, repoContext, 'dev', {\n add: ['needsReview'],\n remove: ['approved', 'changesRequested'],\n }),\n ]);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\nimport { parseBody } from './actions/utils/parseBody';\n\nexport default function closed(app: Application): void {\n app.on(\n 'pull_request.closed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const repo = context.payload.repository;\n const pr = context.payload.pull_request;\n\n if (pr.merged) {\n const parsedBody =\n pr.head.repo.id === repo.id &&\n parseBody(pr.body, repoContext.config.prDefaultOptions);\n const createMergeLockPrFromPr = () => ({\n id: pr.id,\n number: pr.number,\n branch: pr.head.ref,\n });\n await Promise.all([\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr()),\n parsedBody && parsedBody.options.deleteAfterMerge\n ? context.github.git\n .deleteRef(context.repo({ ref: `heads/${pr.head.ref}` }))\n .catch(() => {})\n : undefined,\n ]);\n } else {\n await Promise.all([\n updateReviewStatus(context, repoContext, 'dev', {\n remove: ['needsReview'],\n }),\n ]);\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewRequested(app: Application): void {\n app.on(\n 'pull_request.review_requested',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n\n // ignore if sender is self (dismissed review rerequest review)\n if (sender.type === 'Bot') return;\n\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).requested_reviewer;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n const shouldWait = false;\n // repoContext.reviewShouldWait(reviewerGroup, pr.requested_reviewers, { includesWaitForGroups: true });\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup &&\n review.state === 'REQUEST_CHANGES' &&\n // In case this is a rerequest for review\n review.user.login !== reviewer.login,\n );\n\n if (!hasChangesRequestedInReviews) {\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: ['needsReview', !shouldWait && 'requested'],\n remove: ['approved', 'changesRequested'],\n });\n }\n }\n\n if (sender.login === reviewer.login) return;\n\n if (!shouldWait && repoContext.slack) {\n repoContext.slack.postMessage(\n reviewer.login,\n `:eyes: ${repoContext.slack.mention(\n sender.login,\n )} requests your review on ${pr.html_url} !\\n> ${pr.title}`,\n );\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewRequestRemoved(app: Application): void {\n app.on(\n 'pull_request.review_request_removed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).requested_reviewer;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const hasRequestedReviewsForGroup = repoContext.reviewShouldWait(\n reviewerGroup,\n pr.requested_reviewers,\n {\n includesReviewerGroup: true,\n },\n );\n\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n const hasApprovedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'APPROVED',\n );\n\n const approved =\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n hasApprovedInReviews;\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: [\n // if changes requested by the one which requests was removed\n hasChangesRequestedInReviews && 'changesRequested',\n // if was already approved by another member in the group and has no other requests waiting\n approved && 'approved',\n ],\n // remove labels if has no other requests waiting\n remove: [\n approved && 'needsReview',\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n 'requested',\n ],\n });\n }\n\n if (sender.login === reviewer.login) return;\n\n if (repoContext.slack) {\n repoContext.slack.postMessage(\n reviewer.login,\n `:skull_and_crossbones: ${repoContext.slack.mention(\n sender.login,\n )} removed the request for your review on ${pr.html_url}`,\n );\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewSubmitted(app: Application): void {\n app.on(\n 'pull_request_review.submitted',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const pr = context.payload.pull_request;\n const { user: reviewer, state } = (context.payload as any).review;\n if (pr.user.login === reviewer.login) return;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n let merged;\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const hasRequestedReviewsForGroup = repoContext.reviewShouldWait(\n reviewerGroup,\n pr.requested_reviewers,\n {\n includesReviewerGroup: true,\n // TODO reenable this when accepted can notify request review to slack (dev accepted => design requested) and flag to disable for label (approved design ; still waiting for dev ?)\n // includesWaitForGroups: true,\n },\n );\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n const approved =\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n state === 'approved';\n\n const newLabels = await updateReviewStatus(\n context,\n repoContext,\n reviewerGroup,\n {\n add: [\n approved && 'approved',\n state === 'changes_requested' && 'changesRequested',\n ],\n remove: [\n approved && 'needsReview',\n !(\n hasRequestedReviewsForGroup || state === 'changes_requested'\n ) && 'requested',\n state === 'approved' &&\n !hasChangesRequestedInReviews &&\n 'changesRequested',\n state === 'changes_requested' && 'approved',\n ],\n },\n );\n\n if (approved && !hasChangesRequestedInReviews) {\n merged = await autoMergeIfPossible(\n context,\n repoContext,\n pr,\n newLabels,\n );\n }\n }\n\n const mention = repoContext.slack.mention(reviewer.login);\n const prUrl = pr.html_url;\n\n const message = (() => {\n if (state === 'changes_requested') {\n return `:x: ${mention} requests changes on ${prUrl}`;\n }\n if (state === 'approved') {\n return `:clap: :white_check_mark: ${mention} approves ${prUrl}${\n merged ? ' and PR is merged :tada:' : ''\n }`;\n }\n return `:speech_balloon: ${mention} commented on ${prUrl}`;\n })();\n\n repoContext.slack.postMessage(pr.user.login, message);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewDismissed(app: Application): void {\n app.on(\n 'pull_request_review.dismissed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).review.user;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: ['needsReview', 'requested'],\n remove: [\n !hasChangesRequestedInReviews && 'changesRequested',\n 'approved',\n ],\n });\n }\n\n if (repoContext.slack) {\n if (sender.login === reviewer.login) {\n repoContext.slack.postMessage(\n pr.user.login,\n `:skull: ${repoContext.slack.mention(\n reviewer.login,\n )} dismissed his review on ${pr.html_url}`,\n );\n } else {\n repoContext.slack.postMessage(\n reviewer.login,\n `:skull: ${repoContext.slack.mention(\n sender.login,\n )} dismissed your review on ${pr.html_url}`,\n );\n }\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { updateStatusCheckFromLabels } from './actions/updateStatusCheckFromLabels';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function synchronize(app: Application): void {\n app.on(\n 'pull_request.synchronize',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n // old and new sha\n // const { before, after } = context.payload;\n\n await Promise.all([\n editOpenedPR(context, repoContext),\n // addStatusCheckToLatestCommit\n updateStatusCheckFromLabels(context, repoContext),\n // call autoMergeIfPossible to re-add to the queue when push is fixed\n autoMergeIfPossible(context, repoContext),\n ]);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function edited(app: Application): void {\n app.on(\n 'pull_request.edited',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n await editOpenedPR(context, repoContext);\n\n await autoMergeIfPossible(context, repoContext);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { handlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\nimport { updateStatusCheckFromLabels } from './actions/updateStatusCheckFromLabels';\nimport { autoApproveAndAutoMerge } from './actions/autoApproveAndAutoMerge';\nimport { updateBody } from './actions/utils/updateBody';\n\nexport default function labelsChanged(app: Application): void {\n app.on(\n ['pull_request.labeled', 'pull_request.unlabeled'],\n async (context) => {\n const sender = context.payload.sender;\n const fromRenovate =\n sender.type === 'Bot' &&\n context.payload.pull_request.head.ref.startsWith('renovate/');\n\n if (sender.type === 'Bot' && !fromRenovate) {\n return;\n }\n\n await handlerPullRequestChange(context, async (repoContext) => {\n if (fromRenovate) {\n return autoApproveAndAutoMerge(context, repoContext);\n }\n\n const label = context.payload.label;\n if (repoContext.protectedLabelIds.includes(label.id)) {\n if (context.payload.action === 'labeled') {\n await context.github.issues.removeLabel(\n context.issue({ name: label.name }),\n );\n } else {\n await context.github.issues.addLabels(\n context.issue({ labels: [label.name] }),\n );\n }\n return;\n }\n\n await updateStatusCheckFromLabels(context, repoContext);\n\n if (\n repoContext.labels['feature-branch'] &&\n label.id === repoContext.labels['feature-branch'].id\n ) {\n const prBody = context.payload.pull_request.body;\n const { body } = updateBody(\n prBody,\n {\n featureBranch: false,\n deleteAfterMerge: false,\n },\n undefined,\n {\n featureBranch: context.payload.action === 'labeled',\n },\n );\n\n if (body !== prBody) {\n await context.github.pulls.update(context.issue({ body }));\n }\n } else if (context.payload.action === 'labeled') {\n if (\n repoContext.labels['merge/automerge'] &&\n label.id === repoContext.labels['merge/automerge'].id\n ) {\n await autoMergeIfPossible(context, repoContext);\n }\n }\n });\n },\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestsChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function checkrunCompleted(app: Application): void {\n app.on(\n 'check_run.completed',\n createHandlerPullRequestsChange(\n (context) => context.payload.check_run.pull_requests,\n async (context, repoContext) => {\n await Promise.all(\n context.payload.check_run.pull_requests.map((pr) =>\n context.github.pulls\n .get(\n context.repo({\n number: pr.number,\n }),\n )\n .then((prResult) => {\n return autoMergeIfPossible(context, repoContext, prResult.data);\n }),\n ),\n );\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestsChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function checksuiteCompleted(app: Application): void {\n app.on(\n 'check_suite.completed',\n createHandlerPullRequestsChange(\n (context) => context.payload.check_suite.pull_requests,\n async (context, repoContext) => {\n await Promise.all(\n context.payload.check_suite.pull_requests.map((pr) =>\n context.github.pulls\n .get(\n context.repo({\n number: pr.number,\n }),\n )\n .then((prResult) => {\n return autoMergeIfPossible(context, repoContext, prResult.data);\n }),\n ),\n );\n },\n ),\n );\n}\n","import Webhooks from '@octokit/webhooks';\nimport { Application, Context } from 'probot';\nimport { LockedMergePr } from '../context/repoContext';\nimport { createHandlerPullRequestsChange } from './utils';\n\nconst isSameBranch = (\n context: Context,\n lockedPr: LockedMergePr,\n): boolean => {\n if (!lockedPr) return false;\n return !!context.payload.branches.find((b) => b.name === lockedPr.branch);\n};\n\nexport default function status(app: Application): void {\n app.on(\n 'status',\n createHandlerPullRequestsChange(\n (context, repoContext): LockedMergePr[] => {\n const lockedPr = repoContext.getMergeLockedPr();\n if (!lockedPr) return [];\n\n if (isSameBranch(context, lockedPr)) {\n return [lockedPr];\n }\n\n return [];\n },\n (context, repoContext): void => {\n const lockedPr = repoContext.getMergeLockedPr();\n // check if changed\n if (isSameBranch(context, lockedPr)) {\n repoContext.reschedule(context, lockedPr);\n }\n },\n ),\n );\n}\n","import 'dotenv/config';\nimport { Probot, Application } from 'probot';\nimport openedHandler from './pr-handlers/opened';\nimport closedHandler from './pr-handlers/closed';\nimport reviewRequestedHandler from './pr-handlers/reviewRequested';\nimport reviewRequestRemovedHandler from './pr-handlers/reviewRequestRemoved';\nimport reviewSubmittedHandler from './pr-handlers/reviewSubmitted';\nimport reviewDismissedHandler from './pr-handlers/reviewDismissed';\nimport synchromizeHandler from './pr-handlers/synchronize';\nimport editedHandler from './pr-handlers/edited';\nimport labelsChanged from './pr-handlers/labelsChanged';\nimport checkrunCompleted from './pr-handlers/checkrunCompleted';\nimport checksuiteCompleted from './pr-handlers/checksuiteCompleted';\nimport status from './pr-handlers/status';\n\nif (!process.env.NAME) process.env.NAME = 'reviewflow';\n\n// const getConfig = require('probot-config')\n// const { MongoClient } = require('mongodb');\n\n// const connect = MongoClient.connect(process.env.MONGO_URL);\n// const db = connect.then(client => client.db(process.env.MONGO_DB));\n\n// let config = await getConfig(context, 'reviewflow.yml');\n\n// eslint-disable-next-line import/no-commonjs\nProbot.run((app: Application) => {\n openedHandler(app);\n closedHandler(app);\n reviewRequestedHandler(app);\n reviewRequestRemovedHandler(app);\n\n // app.on('pull_request.closed', async context => {\n\n // });\n\n // app.on('pull_request.reopened', async context => {\n\n // });\n\n reviewSubmittedHandler(app);\n reviewDismissedHandler(app);\n labelsChanged(app);\n synchromizeHandler(app);\n editedHandler(app);\n\n checkrunCompleted(app);\n checksuiteCompleted(app);\n status(app);\n});\n"],"names":["config","slackToken","process","env","ORNIKAR_SLACK_TOKEN","autoAssignToCreator","trimTitle","requiresReviewRequest","prDefaultOptions","featureBranch","deleteAfterMerge","parsePR","title","regExp","error","summary","bot","status","statusInfoFromMatch","match","issue","inBody","url","groups","dev","abarreir","ORNIKAR_EMAIL_DOMAIN","arthurflachs","CorentinAndre","rigma","damienorny","darame07","Pixy","christophehurpeau","HugoGarrido","LentnerStefan","Mxime","tilap","design","jperriere","CoralineColasse","waitForGroups","labels","list","name","color","review","ci","inProgress","succeeded","failed","needsReview","requested","changesRequested","approved","teamConfigs","ornikar","options","optionsRegexps","map","option","regexp","RegExp","optionsLabels","label","commentStart","commentEnd","regexpCols","regexpReviewflowCol","parseOptions","content","defaultConfig","reduce","acc","exec","parseBody","description","reviewFlowCol","reviewflowContent","reviewFlowColMatch","reviewflowContentCol","reviewflowContentColPrefix","reviewflowContentColSuffix","hasFailedStatusOrChecks","context","repoContext","pr","checks","github","listForRef","repo","ref","head","sha","per_page","failedChecks","data","check_runs","filter","check","conclusion","length","log","info","id","combinedStatus","repos","getCombinedStatusForRef","state","failedStatuses","statuses","autoMergeIfPossible","payload","pull_request","prLabels","autoMergeLabel","createMergeLockPrFromPr","number","branch","find","l","debug","removeMergeLockedPr","hasNeedsReview","hasRequestedReview","lockedPr","getMergeLockedPr","pushAutomergeQueue","addMergeLockPr","mergeable","undefined","prResult","pulls","get","pull_number","merged","mergeable_state","reschedule","startsWith","issues","update","body","replace","base","merge","owner","login","parsedBody","mergeResult","merge_method","commit_title","commit_message","Boolean","err","message","initRepoLabels","listLabelsForRepo","finalLabels","labelKey","labelConfig","Object","entries","labelColor","slice","existingLabel","result","createLabel","current_name","updateLabel","getKeys","o","keys","ExcludesFalsy","initTeamSlack","mention","postMessage","Promise","resolve","githubLoginToSlackEmail","groupName","assign","slackClient","WebClient","allUsers","users","limit","members","values","email","member","user","profile","console","warn","im","open","channel","membersMap","Map","getUserFromGithubLogin","githubLogin","text","DRY_RUN","chat","initTeamContext","slackPromise","githubLoginToGroup","forEach","set","getReviewerGroups","githubLogins","Set","getReviewerGroup","reviewShouldWait","reviewerGroup","requestedReviewers","includesReviewerGroup","includesWaitForGroups","requestedReviewerGroups","request","includes","some","group","slack","teamContextsPromise","teamContexts","obtainTeamContext","repository","existingTeamContext","existingPromise","promise","then","teamContext","delete","initRepoContext","create","all","reviewGroupNames","needsReviewLabelIds","key","requestedReviewLabelIds","changesRequestedLabelIds","approvedReviewLabelIds","protectedLabelIds","labelIdToGroupName","reviewGroupLabels","lock","Lock","lockMergePr","automergeQueue","lockPROrPRS","prIdOrIds","callback","reject","createReleaseCallback","release","Error","setTimeout","String","hasChangesRequestedReview","hasApprovesReview","getNeedsReviewGroupNames","shift","p","push","repoContextsPromise","repoContexts","obtainRepoContext","NAME","existingRepoContext","handlerPullRequestChange","createHandlerPullRequestChange","createHandlerPullRequestsChange","getPullRequests","prs","autoAssignPRToCreator","assignees","type","addAssignees","cleanTitle","trim","s","arg1","toLowerCase","toMarkdownOptions","join","toMarkdownInfos","infos","updateBody","updateOptions","parsed","infosParagraph","updatedOptions","editOpenedPR","isPrFromBot","errorRule","rule","date","Date","toISOString","hasLintPrCheck","createStatus","target_url","head_sha","started_at","completed_at","output","featureBranchLabel","prHasFeatureBranchLabel","defaultOptions","hasDiffInTitle","hasDiffInBody","removeLabel","addLabels","addStatusCheck","hasPrCheck","created_at","createFailedStatusCheck","updateStatusCheckFromLabels","requested_reviewers","rr","needsReviewGroupNames","updateReviewStatus","reviewGroup","add","labelsToAdd","remove","labelsToRemove","newLabelNames","toAdd","toDelete","getLabelFromKey","reviewConfig","prLabel","existing","newLabelNamesArray","oldLabels","size","replaceLabels","autoApproveAndAutoMerge","codeApprovedLabel","createReview","event","opened","app","on","fromRenovate","closed","git","deleteRef","catch","reviewRequested","sender","reviewer","requested_reviewer","reviews","listReviews","hasChangesRequestedInReviews","html_url","reviewRequestRemoved","hasRequestedReviewsForGroup","hasApprovedInReviews","reviewSubmitted","newLabels","prUrl","reviewDismissed","synchronize","edited","labelsChanged","action","prBody","checkrunCompleted","check_run","pull_requests","checksuiteCompleted","check_suite","isSameBranch","branches","b","Probot","run","openedHandler","closedHandler","reviewRequestedHandler","reviewRequestRemovedHandler","reviewSubmittedHandler","reviewDismissedHandler","synchromizeHandler","editedHandler"],"mappings":";;;;;;;AAEA,MAAMA,MAAgC,GAAG;EACvCC,UAAU,EAAEC,OAAO,CAACC,GAAR,CAAYC,mBADe;EAEvCC,mBAAmB,EAAE,IAFkB;EAGvCC,SAAS,EAAE,IAH4B;EAIvCC,qBAAqB,EAAE,IAJgB;EAKvCC,gBAAgB,EAAE;IAChBC,aAAa,EAAE,KADC;IAEhBC,gBAAgB,EAAE;GAPmB;EASvCC,OAAO,EAAE;IACPC,KAAK,EAAE,CACL;MACEC,MAAM;gGADR;MAIEC,KAAK,EAAE;QACLF,KAAK,EAAE,8CADF;QAELG,OAAO,EACL;;KARD,EAWL;MACEC,GAAG,EAAE,KADP;MAEEH,MAAM,EAAE,4BAFV;MAGEC,KAAK,EAAE;QACLF,KAAK,EAAE,gCADF;QAELG,OAAO,EAAE;OALb;MAOEE,MAAM,EAAE,YAPV;MAQEC,mBAAmB,EAAGC,KAAD,IAAW;cACxBC,KAAK,GAAGD,KAAK,CAAC,CAAD,CAAnB;;YACIC,KAAK,KAAK,YAAd,EAA4B;iBACnB;YACLR,KAAK,EAAE,UADF;YAELG,OAAO,EAAE;WAFX;;;eAKK;UACLM,MAAM,EAAE,IADH;UAELC,GAAG,EAAG,wCAAuCF,KAAM,EAF9C;UAGLR,KAAK,EAAG,eAAcQ,KAAM,EAHvB;UAILL,OAAO,EAAG,IAAGK,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,QAAV,CAAhB,EAAqC;aAC5B,CAACA,QAAD,CAAP;;;WAGK,EAAP;GAT2B,EAW7B,CAACzC,OAAD,EAAUC,WAAV,KAAgC;UACxBwC,QAAQ,GAAGxC,WAAW,CAACyC,gBAAZ,EAAjB,CAD8B;;QAG1B0P,YAAY,CAACpS,OAAD,EAAUyC,QAAV,CAAhB,EAAqC;MACnCxC,WAAW,CAACoD,UAAZ,CAAuBrD,OAAvB,EAAgCyC,QAAhC;;GAfyB,CAFjC;;;ACCF,IAAI,CAAC3H,OAAO,CAACC,GAAR,CAAYyQ,IAAjB,EAAuB1Q,OAAO,CAACC,GAAR,CAAYyQ,IAAZ,GAAmB,YAAnB;;;;;;;AAWvB+G,aAAM,CAACC,GAAP,CAAYpC,GAAD,IAAsB;EAC/BqC,MAAa,CAACrC,GAAD,CAAb;EACAsC,MAAa,CAACtC,GAAD,CAAb;EACAuC,eAAsB,CAACvC,GAAD,CAAtB;EACAwC,oBAA2B,CAACxC,GAAD,CAA3B,CAJ+B;;;;;EAc/ByC,eAAsB,CAACzC,GAAD,CAAtB;EACA0C,eAAsB,CAAC1C,GAAD,CAAtB;EACAwB,aAAa,CAACxB,GAAD,CAAb;EACA2C,WAAkB,CAAC3C,GAAD,CAAlB;EACA4C,MAAa,CAAC5C,GAAD,CAAb;EAEA2B,iBAAiB,CAAC3B,GAAD,CAAjB;EACA8B,mBAAmB,CAAC9B,GAAD,CAAnB;EACAvU,MAAM,CAACuU,GAAD,CAAN;CAtBF"} \ No newline at end of file +{"version":3,"file":"index-node10.cjs.js","sources":["../src/teamconfigs/ornikar.ts","../src/teamconfigs/christophehurpeau.ts","../src/teamconfigs/index.ts","../src/pr-handlers/actions/utils/prOptions.ts","../src/pr-handlers/actions/utils/parseBody.ts","../src/pr-handlers/actions/autoMergeIfPossible.ts","../src/context/initRepoLabels.ts","../src/context/utils.ts","../src/context/initTeamSlack.ts","../src/context/teamContext.ts","../src/context/repoContext.ts","../src/pr-handlers/utils.ts","../src/pr-handlers/actions/autoAssignPRToCreator.ts","../src/pr-handlers/actions/utils/cleanTitle.ts","../src/pr-handlers/actions/utils/updateBody.ts","../src/pr-handlers/actions/editOpenedPR.ts","../src/pr-handlers/actions/updateStatusCheckFromLabels.ts","../src/pr-handlers/actions/updateReviewStatus.ts","../src/pr-handlers/actions/autoApproveAndAutoMerge.ts","../src/pr-handlers/opened.ts","../src/pr-handlers/closed.ts","../src/pr-handlers/reviewRequested.ts","../src/pr-handlers/reviewRequestRemoved.ts","../src/pr-handlers/reviewSubmitted.ts","../src/pr-handlers/reviewDismissed.ts","../src/pr-handlers/synchronize.ts","../src/pr-handlers/edited.ts","../src/pr-handlers/labelsChanged.ts","../src/pr-handlers/checkrunCompleted.ts","../src/pr-handlers/checksuiteCompleted.ts","../src/pr-handlers/status.ts","../src/index.ts"],"sourcesContent":["import { Config } from './types';\n\nconst config: Config<'dev' | 'design'> = {\n slackToken: process.env.ORNIKAR_SLACK_TOKEN,\n autoAssignToCreator: true,\n trimTitle: true,\n requiresReviewRequest: true,\n prDefaultOptions: {\n featureBranch: false,\n autoMerge: false,\n deleteAfterMerge: true,\n },\n parsePR: {\n title: [\n {\n regExp:\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^(revert: )?(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\\(([a-z\\-/]*)\\))?:\\s/,\n error: {\n title: 'Title does not match commitlint conventional',\n summary:\n 'https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional',\n },\n },\n {\n bot: false,\n regExp: /\\s(ONK-(\\d+)|\\[no issue])$/,\n error: {\n title: 'Title does not have JIRA issue',\n summary: 'The PR title should end with ONK-0000, or [no issue]',\n },\n status: 'jira-issue',\n statusInfoFromMatch: (match) => {\n const issue = match[1];\n if (issue === '[no issue]') {\n return {\n title: 'No issue',\n summary: '',\n };\n }\n return {\n inBody: true,\n url: `https://ornikar.atlassian.net/browse/${issue}`,\n title: `JIRA issue: ${issue}`,\n summary: `[${issue}](https://ornikar.atlassian.net/browse/${issue})`,\n };\n },\n },\n ],\n },\n\n groups: {\n dev: {\n /* back */\n abarreir: `alexandre${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n arthurflachs: `arthur${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n CorentinAndre: `corentin${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n rigma: `romain${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n damienorny: `damien.orny${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n 'Thierry-girod': `thierry${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n darame07: `kevin${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n Pixy: `pierre-alexis${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n /* front */\n christophehurpeau: `christophe${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n HugoGarrido: `hugo${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n LentnerStefan: `stefan${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n Mxime: `maxime${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n tilap: `julien.lavinh${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n '63m29': `valerian${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n },\n design: {\n jperriere: `julien${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n CoralineColasse: `coraline${process.env.ORNIKAR_EMAIL_DOMAIN}`,\n },\n },\n waitForGroups: {\n dev: [],\n design: ['dev'],\n },\n labels: {\n list: {\n // /* ci */\n // 'ci/in-progress': { name: ':green_heart: ci/in-progress', color: '#0052cc' },\n // 'ci/fail': { name: ':green_heart: ci/fail', color: '#e11d21' },\n // 'ci/passed': { name: ':green_heart: ci/passed', color: '#86f9b4' },\n\n /* code */\n 'code/needs-review': {\n name: ':ok_hand: code/needs-review',\n color: '#FFC44C',\n },\n 'code/review-requested': {\n name: ':ok_hand: code/review-requested',\n color: '#DAE1E6',\n },\n 'code/changes-requested': {\n name: ':ok_hand: code/changes-requested',\n color: '#e11d21',\n },\n 'code/approved': {\n name: ':ok_hand: code/approved',\n color: '#64DD17',\n },\n\n /* design */\n 'design/needs-review': {\n name: ':art: design/needs-review',\n color: '#FFC44C',\n },\n 'design/review-requested': {\n name: ':art: design/review-requested',\n color: '#DAE1E6',\n },\n 'design/changes-requested': {\n name: ':art: design/changes-requested',\n color: '#e11d21',\n },\n 'design/approved': {\n name: ':art: design/approved',\n color: '#64DD17',\n },\n\n /* auto merge */\n 'merge/automerge': {\n name: ':soon: automerge',\n color: '#64DD17',\n },\n\n /* feature-branch */\n 'feature-branch': {\n name: 'feature-branch',\n color: '#7FCEFF',\n },\n },\n\n review: {\n ci: {\n inProgress: 'ci/in-progress',\n succeeded: 'ci/success',\n failed: 'ci/fail',\n },\n dev: {\n needsReview: 'code/needs-review',\n requested: 'code/review-requested',\n changesRequested: 'code/changes-requested',\n approved: 'code/approved',\n },\n design: {\n needsReview: 'design/needs-review',\n requested: 'design/review-requested',\n changesRequested: 'design/changes-requested',\n approved: 'design/approved',\n },\n },\n },\n};\n\nexport default config;\n","import { Config } from './types';\n\nconst config: Config<'dev'> = {\n autoAssignToCreator: true,\n trimTitle: true,\n requiresReviewRequest: false,\n prDefaultOptions: {\n featureBranch: false,\n autoMerge: false,\n deleteAfterMerge: true,\n },\n parsePR: {\n title: [\n {\n regExp:\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^(revert: )?(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\\(([a-z\\-/]*)\\))?:\\s/,\n error: {\n title: 'Title does not match commitlint conventional',\n summary:\n 'https://github.com/marionebl/commitlint/tree/master/%40commitlint/config-conventional',\n },\n },\n ],\n },\n groups: {\n dev: {\n christophehurpeau: 'christophe@hurpeau.com',\n 'chris-reviewflow': 'christophe.hurpeau+reviewflow@gmail.com',\n tilap: 'jlavinh@gmail.com',\n },\n },\n waitForGroups: {\n dev: [],\n },\n labels: {\n list: {\n // /* ci */\n // 'ci/in-progress': { name: ':green_heart: ci/in-progress', color: '#0052cc' },\n // 'ci/fail': { name: ':green_heart: ci/fail', color: '#e11d21' },\n // 'ci/passed': { name: ':green_heart: ci/passed', color: '#86f9b4' },\n\n /* code */\n 'code/needs-review': {\n name: ':ok_hand: code/needs-review',\n color: '#FFD57F',\n },\n 'code/review-requested': {\n name: ':ok_hand: code/review-requested',\n color: '#B2E1FF',\n },\n 'code/changes-requested': {\n name: ':ok_hand: code/changes-requested',\n color: '#e11d21',\n },\n 'code/approved': {\n name: ':ok_hand: code/approved',\n color: '#64DD17',\n },\n\n /* auto merge */\n 'merge/automerge': {\n name: ':soon: automerge',\n color: '#64DD17',\n },\n\n /* feature-branch */\n 'feature-branch': {\n name: 'feature-branch',\n color: '#7FCEFF',\n },\n },\n\n review: {\n ci: {\n inProgress: 'ci/in-progress',\n succeeded: 'ci/success',\n failed: 'ci/fail',\n },\n dev: {\n needsReview: 'code/needs-review',\n requested: 'code/review-requested',\n changesRequested: 'code/changes-requested',\n approved: 'code/approved',\n },\n },\n },\n};\n\nexport default config;\n","import { Config as ConfigType } from './types';\nimport ornikar from './ornikar';\nimport christophehurpeau from './christophehurpeau';\n\nexport type Config = ConfigType;\n\nexport const teamConfigs: { [owner: string]: Config } = {\n ornikar,\n christophehurpeau,\n};\n\n// flat requires node 11\n// export const getMembers = (\n// groups: Record,\n// ): string[] => {\n// return Object.values(groups).flat(1);\n// };\n","export type Options = 'featureBranch' | 'autoMerge' | 'deleteAfterMerge';\n\nexport const options: Options[] = [\n 'featureBranch',\n 'autoMerge',\n 'deleteAfterMerge',\n];\nexport const optionsRegexps: { name: Options; regexp: RegExp }[] = options.map(\n (option) => ({\n name: option,\n regexp: new RegExp(`\\\\[([ xX]?)]\\\\s*`),\n }),\n);\n\nexport const optionsLabels: { name: Options; label: string }[] = [\n { name: 'featureBranch', label: 'This PR is a feature branch' },\n {\n name: 'autoMerge',\n label:\n 'Auto merge when this PR is ready and has no failed statuses. (Also has a queue per repo to prevent multiple useless \"Update branch\" triggers)',\n },\n {\n name: 'deleteAfterMerge',\n label: 'Automatic branch delete after this PR is merged',\n },\n];\n","import { Options, optionsRegexps } from './prOptions';\n\nconst commentStart = '';\nconst commentEnd = \"\";\n\nconst regexpCols = /^(.*)((.*)).*$/is;\nconst regexpReviewflowCol = /^(\\s*<\\/td>]*>)\\s*(.*)\\s*(<\\/td><\\/tr><\\/table>\\s*)\\s*$/is;\n\nconst parseOptions = (\n content: string,\n defaultConfig: Record,\n): Record => {\n return optionsRegexps.reduce(\n (acc, { name, regexp }) => {\n const match = regexp.exec(content);\n acc[name] = !match\n ? defaultConfig[name] || false\n : match[1] === 'x' || match[1] === 'X';\n return acc;\n },\n {} as any,\n ) as Record;\n};\n\nexport const parseBody = (\n description: string,\n defaultConfig: Record,\n) => {\n const match = regexpCols.exec(description);\n if (!match) return null;\n const [, content, reviewFlowCol, reviewflowContent] = match;\n const reviewFlowColMatch = regexpReviewflowCol.exec(reviewFlowCol);\n if (!reviewFlowColMatch) {\n return {\n content,\n reviewflowContentCol: reviewflowContent,\n reviewflowContentColPrefix: commentStart,\n reviewflowContentColSuffix: commentEnd,\n options: parseOptions(reviewFlowCol, defaultConfig),\n };\n }\n const [\n ,\n reviewflowContentColPrefix,\n reviewflowContentCol,\n reviewflowContentColSuffix,\n ] = reviewFlowColMatch;\n\n return {\n content,\n reviewflowContentCol,\n reviewflowContentColPrefix,\n reviewflowContentColSuffix,\n options: parseOptions(reviewflowContentCol, defaultConfig),\n };\n};\n","/* eslint-disable max-lines */\nimport { Context } from 'probot';\n// eslint-disable-next-line import/no-cycle\nimport { RepoContext } from '../../context/repoContext';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { parseBody } from './utils/parseBody';\n\nconst hasFailedStatusOrChecks = async (\n context: Context,\n repoContext: RepoContext,\n pr: any,\n) => {\n const checks = await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n per_page: 100,\n }),\n );\n\n const failedChecks = checks.data.check_runs.filter(\n (check) => check.conclusion === 'failure',\n );\n\n if (failedChecks.length !== 0) {\n context.log.info(`automerge not possible: failed check pr ${pr.id}`, {\n checks: failedChecks.map((check) => check.name),\n });\n return true;\n }\n\n const combinedStatus = await context.github.repos.getCombinedStatusForRef(\n context.repo({\n ref: pr.head.sha,\n per_page: 100,\n }),\n );\n\n if (combinedStatus.data.state === 'failure') {\n const failedStatuses = combinedStatus.data.statuses.filter(\n (status) => status.state === 'failure' || status.state === 'error',\n );\n\n context.log.info(`automerge not possible: failed status pr ${pr.id}`, {\n statuses: failedStatuses.map((status) => status.context),\n });\n\n return true;\n }\n\n return false;\n};\n\nexport const autoMergeIfPossible = async (\n context: Context,\n repoContext: RepoContext,\n pr: any = context.payload.pull_request,\n prLabels: LabelResponse[] = pr.labels,\n): Promise => {\n const autoMergeLabel = repoContext.labels['merge/automerge'];\n if (!autoMergeLabel) return false;\n\n const createMergeLockPrFromPr = () => ({\n id: pr.id,\n number: pr.number,\n branch: pr.head.ref,\n });\n\n if (!prLabels.find((l): boolean => l.id === autoMergeLabel.id)) {\n context.log.debug('automerge not possible: no label');\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n }\n\n if (\n repoContext.hasNeedsReview(prLabels) ||\n repoContext.hasRequestedReview(prLabels)\n ) {\n context.log.debug('automerge not possible: blocking labels');\n // repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n }\n\n const lockedPr = repoContext.getMergeLockedPr();\n if (lockedPr && lockedPr.number !== pr.number) {\n context.log.info(`automerge not possible: locked pr ${pr.id}`);\n repoContext.pushAutomergeQueue(createMergeLockPrFromPr());\n return false;\n }\n\n repoContext.addMergeLockPr(createMergeLockPrFromPr());\n\n if (pr.mergeable === undefined) {\n const prResult = await context.github.pulls.get(\n context.repo({\n pull_number: pr.number,\n }),\n );\n pr = prResult.data;\n }\n\n if (pr.merged) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n context.log.info(`automerge not possible: already merged pr ${pr.id}`);\n return false;\n }\n\n context.log.info(\n `automerge?: ${pr.id}, mergeable=${pr.mergeable} state=${\n pr.mergeable_state\n }`,\n );\n\n // https://github.com/octokit/octokit.net/issues/1763\n if (\n !(\n pr.mergeable_state === 'clean' ||\n pr.mergeable_state === 'has_hooks' ||\n pr.mergeable_state === 'unstable'\n )\n ) {\n if (!pr.mergeable_state || pr.mergeable_state === 'unknown') {\n context.log.info(`automerge not possible: rescheduling ${pr.id}`);\n // GitHub is determining whether the pull request is mergeable\n repoContext.reschedule(context, createMergeLockPrFromPr());\n return false;\n }\n\n if (pr.head.ref.startsWith('renovate/')) {\n if (pr.mergeable_state === 'behind' || pr.mergeable_state === 'dirty') {\n context.log.info(\n `automerge not possible: rebase renovate branch pr ${pr.id}`,\n );\n // TODO check if has commits not made by renovate https://github.com/ornikar/shared-configs/pull/47#issuecomment-445767120\n\n await context.github.issues.update(\n context.repo({\n number: pr.number,\n body: pr.body.replace(\n '[ ] ',\n '[x] ',\n ),\n }),\n );\n return false;\n }\n\n if (await hasFailedStatusOrChecks(context, repoContext, pr)) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n } else if (pr.mergeable_state === 'blocked') {\n // waiting for reschedule in status (pr-handler/status.ts)\n return false;\n }\n\n context.log.info(\n `automerge not possible: renovate with mergeable_state=${\n pr.mergeable_state\n }`,\n );\n return false;\n }\n\n if (pr.mergeable_state === 'blocked') {\n if (await hasFailedStatusOrChecks(context, repoContext, pr)) {\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return false;\n } else {\n // waiting for reschedule in status (pr-handler/status.ts)\n return false;\n }\n }\n\n if (pr.mergeable_state === 'behind') {\n context.log.info('automerge not possible: update branch', {\n head: pr.head.ref,\n base: pr.base.ref,\n });\n\n await context.github.repos.merge({\n owner: pr.head.repo.owner.login,\n repo: pr.head.repo.name,\n head: pr.base.ref,\n base: pr.head.ref,\n });\n\n return false;\n }\n\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n context.log.info(\n `automerge not possible: not mergeable mergeable_state=${\n pr.mergeable_state\n }`,\n );\n return false;\n }\n\n try {\n context.log.info(`automerge pr #${pr.number}`);\n const parsedBody = parseBody(pr.body, repoContext.config.prDefaultOptions);\n const mergeResult = await context.github.pulls.merge({\n merge_method:\n parsedBody && parsedBody.options.featureBranch ? 'merge' : 'squash',\n owner: pr.head.repo.owner.login,\n repo: pr.head.repo.name,\n pull_number: pr.number,\n commit_title: `${pr.title} (#${pr.number})`,\n commit_message: '', // TODO add BC\n });\n context.log.debug('merge result:', mergeResult.data);\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr());\n return Boolean(mergeResult.data.merged);\n } catch (err) {\n context.log.info('could not merge:', err.message);\n repoContext.reschedule(context, createMergeLockPrFromPr());\n return false;\n }\n};\n","import { Context } from 'probot';\nimport { Config } from '../teamconfigs';\n\nexport interface LabelResponse {\n id: number;\n node_id: string;\n url: string;\n name: string;\n description: string;\n color: string;\n default: boolean;\n}\n\nexport interface Labels {\n [key: string]: LabelResponse;\n}\n\nexport const initRepoLabels = async (\n context: Context,\n config: Config,\n): Promise => {\n const { data: labels } = await context.github.issues.listLabelsForRepo(\n context.repo({ per_page: 100 }),\n );\n const finalLabels: Record = {};\n\n for (const [labelKey, labelConfig] of Object.entries(config.labels.list)) {\n const labelColor = labelConfig.color.slice(1);\n const description = `Generated by review-flow for ${labelKey}`;\n\n let existingLabel = labels.find((label) => label.name === labelConfig.name);\n if (!existingLabel) {\n existingLabel = labels.find((label) => label.description === description);\n }\n if (!existingLabel) {\n if (labelKey === 'design/needs-review') {\n existingLabel = labels.find(\n (label) => label.name === 'needs-design-review',\n );\n }\n if (labelKey === 'design/approved') {\n existingLabel = labels.find(\n (label) => label.name === 'design-reviewed',\n );\n }\n }\n\n if (!existingLabel) {\n const result = await context.github.issues.createLabel(\n context.repo({\n name: labelConfig.name,\n color: labelColor,\n description,\n }),\n );\n finalLabels[labelKey] = result.data;\n } else if (\n existingLabel.name !== labelConfig.name ||\n existingLabel.color !== labelColor // ||\n // TODO: description is never updated\n // existingLabel.description !== description\n ) {\n context.log.info('Needs to update label', {\n current_name: existingLabel.name,\n name: existingLabel.name !== labelConfig.name && labelConfig.name,\n color: existingLabel.color !== labelColor && labelColor,\n description: existingLabel.description !== description && description,\n });\n\n const result = await context.github.issues.updateLabel(\n context.repo({\n current_name: existingLabel.name,\n name: labelConfig.name,\n color: labelColor,\n description,\n }),\n );\n finalLabels[labelKey] = result.data;\n } else {\n finalLabels[labelKey] = existingLabel;\n }\n }\n\n return finalLabels;\n};\n","export const getKeys = (o: T): (keyof T)[] =>\n Object.keys(o) as (keyof T)[];\n","import { WebClient } from '@slack/web-api';\nimport { Context } from 'probot';\nimport { Config } from '../teamconfigs';\nimport { getKeys } from './utils';\n\nexport interface TeamSlack {\n mention: (githubLogin: string) => string;\n postMessage: (githubLogin: string, text: string) => Promise;\n}\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport const initTeamSlack = async (\n context: Context,\n config: Config,\n): Promise => {\n if (!config.slackToken) {\n return {\n mention: (githubLogin: string) => '',\n postMessage: (githubLogin: string, text: string) => Promise.resolve(),\n };\n }\n\n const githubLoginToSlackEmail = getKeys(config.groups).reduce<{\n [login: string]: string;\n }>((acc, groupName) => {\n Object.assign(acc, config.groups[groupName]);\n return acc;\n }, {});\n\n const slackClient = new WebClient(config.slackToken);\n const allUsers: any = await slackClient.users.list({ limit: 200 });\n const members: [string, { member: any; im: any }][] = Object.values(\n githubLoginToSlackEmail,\n )\n .map((email) => {\n const member = allUsers.members.find(\n (user: any) => user.profile.email === email,\n );\n if (!member) {\n console.warn(`Could not find user ${email}`);\n return;\n }\n return [email, { member, im: undefined }] as [\n string,\n { member: any; im: any }\n ];\n })\n .filter(ExcludesFalsy);\n\n for (const [, user] of members) {\n try {\n const im: any = await slackClient.im.open({ user: user.member.id });\n user.im = im.channel;\n } catch (err) {\n console.error(err);\n }\n }\n\n const membersMap = new Map(members);\n\n const getUserFromGithubLogin = (githubLogin: string) => {\n const email = githubLoginToSlackEmail[githubLogin];\n if (!email) return null;\n return membersMap.get(email);\n };\n\n return {\n mention: (githubLogin: string) => {\n const user = getUserFromGithubLogin(githubLogin);\n if (!user) return githubLogin;\n return `<@${user.member.id}>`;\n },\n postMessage: async (githubLogin: string, text: string) => {\n context.log.info('send slack', { githubLogin, text });\n if (process.env.DRY_RUN) return;\n\n const user = getUserFromGithubLogin(githubLogin);\n if (!user || !user.im) return;\n await slackClient.chat.postMessage({\n channel: user.im.id,\n text,\n });\n },\n };\n};\n","import { Context } from 'probot';\nimport { Config } from '../teamconfigs';\nimport { initTeamSlack, TeamSlack } from './initTeamSlack';\nimport { getKeys } from './utils';\n\nexport interface TeamContext {\n config: Config;\n slack: TeamSlack;\n getReviewerGroup: (githubLogin: string) => string | undefined;\n getReviewerGroups: (githubLogins: string[]) => string[];\n reviewShouldWait: (\n reviewerGroup: GroupNames | undefined,\n requestedReviewers: any[],\n {\n includesReviewerGroup,\n includesWaitForGroups,\n }: { includesReviewerGroup?: boolean; includesWaitForGroups?: boolean },\n ) => boolean;\n}\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nconst initTeamContext = async (\n context: Context,\n config: Config,\n): Promise => {\n const slackPromise = initTeamSlack(context, config);\n\n const githubLoginToGroup = getKeys(config.groups).reduce>(\n (acc, groupName) => {\n Object.keys(config.groups[groupName]).forEach((login) => {\n acc.set(login, groupName);\n });\n return acc;\n },\n new Map(),\n );\n\n const getReviewerGroups = (githubLogins: string[]) => [\n ...new Set(\n githubLogins\n .map((githubLogin) => githubLoginToGroup.get(githubLogin))\n .filter(Boolean),\n ),\n ];\n\n return {\n config,\n getReviewerGroup: (githubLogin) => githubLoginToGroup.get(githubLogin),\n getReviewerGroups: (githubLogins) => [\n ...new Set(\n githubLogins\n .map((githubLogin) => githubLoginToGroup.get(githubLogin))\n .filter(ExcludesFalsy),\n ),\n ],\n\n reviewShouldWait: (\n reviewerGroup,\n requestedReviewers,\n { includesReviewerGroup, includesWaitForGroups },\n ) => {\n if (!reviewerGroup) return false;\n\n const requestedReviewerGroups = getReviewerGroups(\n requestedReviewers.map((request) => request.login),\n );\n\n // contains another request of a reviewer in the same group\n if (\n includesReviewerGroup &&\n requestedReviewerGroups.includes(reviewerGroup)\n ) {\n return true;\n }\n\n // contains a request from a dependent group\n if (config.waitForGroups && includesWaitForGroups) {\n const waitForGroups = config.waitForGroups;\n return requestedReviewerGroups.some((group) =>\n waitForGroups[reviewerGroup].includes(group),\n );\n }\n\n return false;\n },\n\n slack: await slackPromise,\n };\n};\n\nconst teamContextsPromise = new Map();\nconst teamContexts = new Map();\n\nexport const obtainTeamContext = (\n context: Context,\n config: Config,\n): Promise => {\n const owner = context.payload.repository.owner;\n\n const existingTeamContext = teamContexts.get(owner.login);\n if (existingTeamContext) return existingTeamContext;\n\n const existingPromise = teamContextsPromise.get(owner.login);\n if (existingPromise) return Promise.resolve(existingPromise);\n\n const promise = initTeamContext(context, config);\n teamContextsPromise.set(owner.login, promise);\n\n return promise.then((teamContext) => {\n teamContextsPromise.delete(owner.login);\n teamContexts.set(owner.login, teamContext);\n return teamContext;\n });\n};\n","/* eslint-disable max-lines */\n\nimport { Lock } from 'lock';\nimport { Context } from 'probot';\nimport { teamConfigs, Config } from '../teamconfigs';\n// eslint-disable-next-line import/no-cycle\nimport { autoMergeIfPossible } from '../pr-handlers/actions/autoMergeIfPossible';\nimport { initRepoLabels, LabelResponse, Labels } from './initRepoLabels';\nimport { obtainTeamContext, TeamContext } from './teamContext';\n\nexport interface LockedMergePr {\n id: number;\n number: number;\n branch: string;\n}\n\ninterface RepoContextWithoutTeamContext {\n labels: Labels;\n protectedLabelIds: readonly LabelResponse['id'][];\n\n hasNeedsReview: (labels: LabelResponse[]) => boolean;\n hasRequestedReview: (labels: LabelResponse[]) => boolean;\n hasChangesRequestedReview: (labels: LabelResponse[]) => boolean;\n hasApprovesReview: (labels: LabelResponse[]) => boolean;\n getNeedsReviewGroupNames: (labels: LabelResponse[]) => GroupNames[];\n\n lockPROrPRS(\n prIdOrIds: string | string[],\n callback: () => Promise | void,\n ): Promise;\n\n getMergeLockedPr(): LockedMergePr;\n addMergeLockPr(pr: LockedMergePr): void;\n removeMergeLockedPr(context: Context, pr: LockedMergePr): void;\n reschedule(context: Context, pr: LockedMergePr): void;\n pushAutomergeQueue(pr: LockedMergePr): void;\n}\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport type RepoContext = TeamContext<\n GroupNames\n> &\n RepoContextWithoutTeamContext;\n\nasync function initRepoContext(\n context: Context,\n config: Config,\n): Promise> {\n const teamContext = await obtainTeamContext(context, config);\n const repoContext = Object.create(teamContext);\n\n const [labels] = await Promise.all([initRepoLabels(context, config)]);\n\n const reviewGroupNames = Object.keys(config.groups) as GroupNames[];\n\n const needsReviewLabelIds = reviewGroupNames\n .map((key: GroupNames) => config.labels.review[key].needsReview)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const requestedReviewLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].requested)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const changesRequestedLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].changesRequested)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const approvedReviewLabelIds = reviewGroupNames\n .map((key) => config.labels.review[key].approved)\n .filter(Boolean)\n .map((name) => labels[name].id);\n\n const protectedLabelIds = [\n ...requestedReviewLabelIds,\n ...changesRequestedLabelIds,\n ...approvedReviewLabelIds,\n ];\n\n const labelIdToGroupName = new Map();\n reviewGroupNames.forEach((key) => {\n const reviewGroupLabels = config.labels.review[key] as any;\n Object.keys(reviewGroupLabels).forEach((labelKey: string) => {\n labelIdToGroupName.set(labels[reviewGroupLabels[labelKey]].id, key);\n });\n });\n\n // const updateStatusCheck = (context, reviewGroup, statusInfo) => {};\n\n const hasNeedsReview = (labels: LabelResponse[]) =>\n labels.some((label) => needsReviewLabelIds.includes(label.id));\n const hasRequestedReview = (labels: LabelResponse[]) =>\n labels.some((label) => requestedReviewLabelIds.includes(label.id));\n const hasChangesRequestedReview = (labels: LabelResponse[]) =>\n labels.some((label) => changesRequestedLabelIds.includes(label.id));\n const hasApprovesReview = (labels: LabelResponse[]) =>\n labels.some((label) => approvedReviewLabelIds.includes(label.id));\n\n const getNeedsReviewGroupNames = (labels: LabelResponse[]): GroupNames[] =>\n labels\n .filter((label) => needsReviewLabelIds.includes(label.id))\n .map((label) => labelIdToGroupName.get(label.id))\n .filter(ExcludesFalsy);\n\n const lock = Lock();\n let lockMergePr: LockedMergePr | undefined;\n const automergeQueue: LockedMergePr[] = [];\n\n const lockPROrPRS = (\n prIdOrIds: string | string[],\n callback: () => Promise | void,\n ): Promise =>\n new Promise((resolve, reject) => {\n console.log('lock: try to lock pr', { prIdOrIds });\n lock(prIdOrIds, async (createReleaseCallback) => {\n const release = createReleaseCallback(() => {});\n console.log('lock: lock acquired', { prIdOrIds });\n try {\n await callback();\n } catch (err) {\n console.log('lock: release pr (with error)', { prIdOrIds });\n release();\n reject(err);\n return;\n }\n console.log('lock: release pr', { prIdOrIds });\n release();\n resolve();\n });\n });\n\n const reschedule = (context: Context, pr: LockedMergePr) => {\n if (!pr) throw new Error('Cannot reschedule undefined');\n context.log.info('reschedule', pr);\n setTimeout(() => {\n lockPROrPRS('reschedule', () => {\n return lockPROrPRS(String(pr.id), async () => {\n const prResult = await context.github.pulls.get(\n context.repo({\n pull_number: pr.number,\n }),\n );\n await autoMergeIfPossible(context, repoContext, prResult.data);\n });\n });\n }, 1000);\n };\n\n return Object.assign(repoContext, {\n labels,\n protectedLabelIds,\n hasNeedsReview,\n hasRequestedReview,\n hasChangesRequestedReview,\n hasApprovesReview,\n getNeedsReviewGroupNames,\n\n getMergeLockedPr: () => lockMergePr,\n addMergeLockPr: (pr: LockedMergePr): void => {\n console.log('merge lock: lock', pr);\n if (lockMergePr && lockMergePr.number === pr.number) return;\n if (lockMergePr) throw new Error('Already have lock');\n lockMergePr = pr;\n },\n removeMergeLockedPr: (context, pr: LockedMergePr): void => {\n console.log('merge lock: remove', pr);\n if (!lockMergePr || lockMergePr.number !== pr.number) return;\n lockMergePr = automergeQueue.shift();\n console.log('merge lock: next', lockMergePr);\n if (lockMergePr) {\n reschedule(context, lockMergePr);\n }\n },\n pushAutomergeQueue: (pr: LockedMergePr): void => {\n console.log('merge lock: push queue', {\n pr,\n lockMergePr,\n automergeQueue,\n });\n if (!automergeQueue.some((p) => p.number === pr.number)) {\n automergeQueue.push(pr);\n }\n },\n reschedule,\n\n lockPROrPRS,\n } as RepoContextWithoutTeamContext);\n}\n\nconst repoContextsPromise = new Map>();\nconst repoContexts = new Map();\n\nexport const obtainRepoContext = (\n context: Context,\n): Promise | RepoContext | null => {\n const repo = context.payload.repository;\n if (\n repo.name === 'reviewflow-test' &&\n process.env.NAME !== 'reviewflow-test'\n ) {\n return null;\n }\n const owner = repo.owner;\n if (!teamConfigs[owner.login]) {\n console.warn(owner.login, Object.keys(teamConfigs));\n return null;\n }\n const key = repo.id;\n\n const existingRepoContext = repoContexts.get(key);\n if (existingRepoContext) return existingRepoContext;\n\n const existingPromise = repoContextsPromise.get(key);\n if (existingPromise) return Promise.resolve(existingPromise);\n\n const promise = initRepoContext(context, teamConfigs[owner.login]);\n repoContextsPromise.set(key, promise);\n\n return promise.then((repoContext) => {\n repoContextsPromise.delete(key);\n repoContexts.set(key, repoContext);\n return repoContext;\n });\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { obtainRepoContext, RepoContext } from '../context/repoContext';\n\nexport type Handler = (\n context: Context,\n repoContext: RepoContext,\n) => Promise;\n\nexport type CallbackWithRepoContext = (\n repoContext: RepoContext,\n) => void | Promise;\n\nexport const handlerPullRequestChange = async <\n T extends Webhooks.WebhookPayloadPullRequest\n>(\n context: Context,\n callback: CallbackWithRepoContext,\n): Promise => {\n const repoContext = await obtainRepoContext(context);\n if (!repoContext) return;\n\n repoContext.lockPROrPRS(String(context.payload.pull_request.id), async () => {\n await callback(repoContext);\n });\n};\n\ntype CallbackContextAndRepoContext = (\n context: Context,\n repoContext: RepoContext,\n) => void | Promise;\n\nexport const createHandlerPullRequestChange = <\n T extends Webhooks.WebhookPayloadPullRequest\n>(\n callback: CallbackContextAndRepoContext,\n) => (context: Context) => {\n return handlerPullRequestChange(context, (repoContext) =>\n callback(context, repoContext),\n );\n};\n\nexport const createHandlerPullRequestsChange = (\n getPullRequests: (\n context: Context,\n repoContext: RepoContext,\n ) => { id: string | number }[],\n callback: CallbackContextAndRepoContext,\n) => async (context: Context): Promise => {\n const repoContext = await obtainRepoContext(context);\n if (!repoContext) return;\n\n const prs = getPullRequests(context, repoContext);\n if (prs.length === 0) return;\n return repoContext.lockPROrPRS(prs.map((pr) => String(pr.id)), () =>\n callback(context, repoContext),\n );\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Handler } from '../utils';\n\nexport const autoAssignPRToCreator: Handler<\n Webhooks.WebhookPayloadPullRequest\n> = async (context, repoContext) => {\n if (!repoContext.config.autoAssignToCreator) return;\n\n const pr = context.payload.pull_request;\n if (pr.assignees.length !== 0) return;\n if (pr.user.type === 'Bot') return;\n\n await context.github.issues.addAssignees(\n context.issue({\n assignees: [pr.user.login],\n }),\n );\n};\n","export const cleanTitle = (title: string): string =>\n title\n .trim()\n .replace(/[\\s-]+\\[?\\s*ONK[- ](\\d+)\\s*]?\\s*$/i, ' ONK-$1')\n .replace(/^([A-Za-z]+)[/:]\\s*/, (s, arg1) => `${arg1.toLowerCase()}: `)\n .replace(/^Revert \"([^\"]+)\"$/, 'revert: $1')\n // eslint-disable-next-line unicorn/no-unsafe-regex\n .replace(/^(revert:.*)(\\s+\\(#\\d+\\))$/, '$1');\n","import { StatusInfo } from '../../../teamconfigs/types';\nimport { parseBody } from './parseBody';\nimport { Options, optionsLabels } from './prOptions';\n\nconst toMarkdownOptions = (options: Record) => {\n return optionsLabels\n .map(\n ({ name, label }) =>\n `- [${options[name] ? 'x' : ' '}] ${label}`,\n )\n .join('\\n');\n};\n\nconst toMarkdownInfos = (infos: StatusInfo[]) => {\n return infos\n .map((info) => {\n if (info.url) return `[${info.title}](${info.url})`;\n return info.title;\n })\n .join('\\n');\n};\n\ninterface UpdatedBodyWithOptions {\n body: string;\n options?: Record;\n}\n\nexport const updateBody = (\n body: string,\n defaultConfig: Record,\n infos?: StatusInfo[],\n updateOptions?: Partial>,\n): UpdatedBodyWithOptions => {\n const parsed = parseBody(body, defaultConfig);\n if (!parsed) {\n console.info('could not parse body');\n return { body };\n }\n const {\n content,\n reviewflowContentCol,\n reviewflowContentColPrefix,\n reviewflowContentColSuffix,\n options,\n } = parsed;\n\n // eslint-disable-next-line no-nested-ternary\n const infosParagraph = !infos\n ? reviewflowContentCol.replace(\n // eslint-disable-next-line unicorn/no-unsafe-regex\n /^\\s*(?:(#### Infos:.*)?#### Options:)?.*$/s,\n '$1',\n )\n : infos.length !== 0\n ? `#### Infos:\\n${toMarkdownInfos(infos)}\\n`\n : '';\n\n const updatedOptions = !updateOptions\n ? options\n : { ...options, ...updateOptions };\n\n return {\n options: updatedOptions,\n body: `${content}${reviewflowContentColPrefix}\n${infosParagraph}#### Options:\n${toMarkdownOptions(updatedOptions)}\n${reviewflowContentColSuffix}\n`,\n };\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { RepoContext } from '../../context/repoContext';\nimport { StatusError, StatusInfo } from '../../teamconfigs/types';\nimport { cleanTitle } from './utils/cleanTitle';\nimport { updateBody } from './utils/updateBody';\n\ninterface StatusWithInfo {\n name: string;\n info: StatusInfo;\n error?: undefined;\n}\n\ninterface StatusWithError {\n name: string;\n error: StatusError;\n info?: undefined;\n}\n\ntype Status = StatusWithInfo | StatusWithError;\n\nconst ExcludesFalsy = (Boolean as any) as (\n x: T | false | null | undefined,\n) => x is T;\n\nexport const editOpenedPR = async (\n context: Context,\n repoContext: RepoContext,\n): Promise => {\n const repo = context.payload.repository;\n const pr = context.payload.pull_request;\n\n // do not lint pr from forks\n if (pr.head.repo.id !== repo.id) return;\n\n const title = repoContext.config.trimTitle ? cleanTitle(pr.title) : pr.title;\n\n const isPrFromBot = pr.user.type === 'Bot';\n\n const statuses: Status[] = [];\n\n const errorRule = repoContext.config.parsePR.title.find((rule) => {\n if (rule.bot === false && isPrFromBot) return false;\n\n const match = rule.regExp.exec(pr.title);\n if (match === null) {\n if (rule.status) {\n statuses.push({ name: rule.status, error: rule.error });\n }\n return true;\n }\n\n if (rule.status && rule.statusInfoFromMatch) {\n statuses.push({\n name: rule.status,\n info: rule.statusInfoFromMatch(match),\n });\n return false;\n }\n\n return false;\n });\n\n const date = new Date().toISOString();\n\n const hasLintPrCheck = (await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n }),\n )).data.check_runs.find(\n (check) => check.name === `${process.env.NAME}/lint-pr`,\n );\n\n await Promise.all(\n [\n ...statuses.map(({ name, error, info }) =>\n context.github.repos.createStatus(\n context.repo({\n context: `${process.env.NAME}/${name}`,\n sha: pr.head.sha,\n state: (error ? 'failure' : 'success') as 'failure' | 'success',\n target_url: error ? undefined : (info as StatusInfo).url,\n description: error ? error.title : (info as StatusInfo).title,\n }),\n ),\n ),\n hasLintPrCheck &&\n context.github.checks.create(\n context.repo({\n name: `${process.env.NAME}/lint-pr`,\n head_sha: pr.head.sha,\n status: 'completed' as 'completed',\n conclusion: (errorRule ? 'failure' : 'success') as\n | 'failure'\n | 'success',\n started_at: date,\n completed_at: date,\n output: errorRule\n ? errorRule.error\n : {\n title: '✓ Your PR is valid',\n summary: '',\n },\n }),\n ),\n !hasLintPrCheck &&\n context.github.repos.createStatus(\n context.repo({\n context: `${process.env.NAME}/lint-pr`,\n sha: pr.head.sha,\n state: (errorRule ? 'failure' : 'success') as 'failure' | 'success',\n target_url: undefined,\n description: errorRule\n ? errorRule.error.title\n : '✓ Your PR is valid',\n }),\n ),\n ].filter(ExcludesFalsy),\n );\n\n const featureBranchLabel = repoContext.labels['feature-branch'];\n const automergeLabel = repoContext.labels['merge/automerge'];\n\n const prHasFeatureBranchLabel = Boolean(\n featureBranchLabel &&\n pr.labels.find((label): boolean => label.id === featureBranchLabel.id),\n );\n\n const prHasAutoMergeLabel = Boolean(\n automergeLabel &&\n pr.labels.find((label): boolean => label.id === automergeLabel.id),\n );\n\n const defaultOptions = {\n ...repoContext.config.prDefaultOptions,\n autoMerge: prHasAutoMergeLabel,\n featureBranch: prHasFeatureBranchLabel,\n };\n\n const { body, options } = updateBody(pr.body, defaultOptions, statuses\n .filter((status) => status.info && status.info.inBody)\n .map((status) => status.info) as StatusInfo[]);\n\n const hasDiffInTitle = pr.title !== title;\n const hasDiffInBody = pr.body !== body;\n if (hasDiffInTitle || hasDiffInBody) {\n const update: Partial> = {};\n if (hasDiffInTitle) {\n update.title = title;\n pr.title = title;\n }\n if (hasDiffInBody) {\n update.body = body;\n pr.body = body;\n }\n\n await context.github.issues.update(context.issue(update));\n }\n\n if (options && (featureBranchLabel || automergeLabel)) {\n if (featureBranchLabel) {\n if (prHasFeatureBranchLabel && !options.featureBranch) {\n await context.github.issues.removeLabel(\n context.issue({ name: featureBranchLabel.name }),\n );\n }\n if (options.featureBranch && !prHasFeatureBranchLabel) {\n await context.github.issues.addLabels(\n context.issue({ labels: [featureBranchLabel.name] }),\n );\n }\n }\n\n if (automergeLabel) {\n if (prHasAutoMergeLabel && !options.autoMerge) {\n await context.github.issues.removeLabel(\n context.issue({ name: automergeLabel.name }),\n );\n }\n if (options.autoMerge && !prHasAutoMergeLabel) {\n await context.github.issues.addLabels(\n context.issue({ labels: [automergeLabel.name] }),\n );\n }\n }\n }\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { RepoContext } from '../../context/repoContext';\n\nconst addStatusCheck = async function<\n E extends Webhooks.WebhookPayloadPullRequest\n>(\n context: Context,\n pr: any,\n { state, description }: { state: 'failure' | 'success'; description: string },\n): Promise {\n const hasPrCheck = (await context.github.checks.listForRef(\n context.repo({\n ref: pr.head.sha,\n }),\n )).data.check_runs.find((check) => check.name === process.env.NAME);\n\n context.log.info('add status check', { hasPrCheck, state, description });\n\n if (hasPrCheck) {\n await context.github.checks.create(\n context.repo({\n name: process.env.NAME as string,\n head_sha: pr.head.sha,\n started_at: pr.created_at,\n status: 'completed',\n conclusion: state,\n completed_at: new Date().toISOString(),\n output: {\n title: description,\n summary: '',\n },\n }),\n );\n } else {\n await context.github.repos.createStatus(\n context.repo({\n context: process.env.NAME,\n sha: pr.head.sha,\n state,\n target_url: undefined,\n description,\n }),\n );\n }\n};\n\nconst createFailedStatusCheck = (\n context: Context,\n pr: any,\n description: string,\n): Promise =>\n addStatusCheck(context, pr, {\n state: 'failure',\n description,\n });\n\nexport const updateStatusCheckFromLabels = (\n context: Context,\n repoContext: RepoContext,\n pr: any = context.payload.pull_request,\n labels: LabelResponse[] = pr.labels || [],\n): Promise => {\n context.log.info('updateStatusCheckFromLabels', {\n labels: labels.map((l) => l && l.name),\n hasNeedsReview: repoContext.hasNeedsReview(labels),\n hasApprovesReview: repoContext.hasApprovesReview(labels),\n });\n\n if (pr.requested_reviewers.length !== 0) {\n return createFailedStatusCheck(\n context,\n pr,\n `Awaiting review from: ${pr.requested_reviewers\n .map((rr: any) => rr.login)\n .join(', ')}`,\n );\n }\n\n if (repoContext.hasChangesRequestedReview(labels)) {\n return createFailedStatusCheck(\n context,\n pr,\n 'Changes requested ! Push commits or discuss changes then re-request a review.',\n );\n }\n\n const needsReviewGroupNames = repoContext.getNeedsReviewGroupNames(labels);\n\n if (needsReviewGroupNames.length !== 0) {\n return createFailedStatusCheck(\n context,\n pr,\n `Awaiting review from: ${needsReviewGroupNames.join(\n ', ',\n )}. Perhaps request someone ?`,\n );\n }\n\n if (!repoContext.hasApprovesReview(labels)) {\n if (\n repoContext.config.requiresReviewRequest &&\n !pr.head.ref.startsWith('renovate/')\n ) {\n return createFailedStatusCheck(\n context,\n pr,\n 'Awaiting review... Perhaps request someone ?',\n );\n }\n }\n\n // if (\n // repoContext.config.requiresReviewRequest &&\n // !repoContext.hasRequestedReview(labels)\n // ) {\n // return createFailedStatusCheck(\n // context,\n // pr,\n // 'You need to request someone to review the PR',\n // );\n // return;\n // }\n // return createInProgressStatusCheck(context);\n // } else if (repoContext.hasApprovesReview(labels)) {\n return addStatusCheck(context, pr, {\n state: 'success',\n description: '✓ PR ready to merge !',\n });\n // }\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { LabelResponse } from '../../context/initRepoLabels';\nimport { GroupLabels } from '../../teamconfigs/types';\nimport { RepoContext } from '../../context/repoContext';\nimport { updateStatusCheckFromLabels } from './updateStatusCheckFromLabels';\n\nexport const updateReviewStatus = async <\n E extends Webhooks.WebhookPayloadPullRequest,\n GroupNames extends string = any\n>(\n context: Context,\n repoContext: RepoContext,\n reviewGroup: GroupNames,\n {\n add: labelsToAdd,\n remove: labelsToRemove,\n }: {\n add?: (GroupLabels | false | undefined)[];\n remove?: (GroupLabels | false | undefined)[];\n },\n): Promise => {\n context.log.info('updateReviewStatus', {\n reviewGroup,\n labelsToAdd,\n labelsToRemove,\n });\n\n const pr = context.payload.pull_request;\n let prLabels = pr.labels || [];\n if (!reviewGroup) return prLabels;\n\n const newLabelNames = new Set(\n prLabels.map((label: LabelResponse) => label.name),\n );\n\n const toAdd = new Set();\n const toDelete = new Set();\n const labels = repoContext.labels;\n\n const getLabelFromKey = (key: GroupLabels): undefined | LabelResponse => {\n const reviewConfig = repoContext.config.labels.review[reviewGroup];\n if (!reviewConfig) return undefined;\n\n return reviewConfig[key] && labels[reviewConfig[key]]\n ? labels[reviewConfig[key]]\n : undefined;\n };\n\n if (labelsToAdd) {\n labelsToAdd.forEach((key) => {\n if (!key) return;\n const label = getLabelFromKey(key);\n if (\n !label ||\n prLabels.some((prLabel: LabelResponse) => prLabel.id === label.id)\n ) {\n return;\n }\n newLabelNames.add(label.name);\n toAdd.add(key);\n });\n }\n\n if (labelsToRemove) {\n labelsToRemove.forEach((key) => {\n if (!key) return;\n const label = getLabelFromKey(key);\n if (!label) return;\n const existing = prLabels.find(\n (prLabel: LabelResponse) => prLabel.id === label.id,\n );\n if (existing) {\n newLabelNames.delete(existing.name);\n toDelete.add(key);\n }\n });\n }\n\n const newLabelNamesArray = [...newLabelNames];\n\n context.log.info('updateReviewStatus', {\n reviewGroup,\n toAdd: [...toAdd],\n toDelete: [...toDelete],\n oldLabels: prLabels.map((l: LabelResponse) => l.name),\n newLabelNames: newLabelNamesArray,\n });\n\n // if (process.env.DRY_RUN) return;\n\n if (toAdd.size || toDelete.size) {\n const result = await context.github.issues.replaceLabels(\n context.issue({\n labels: newLabelNamesArray,\n }),\n );\n prLabels = result.data;\n }\n\n // if (toAdd.has('needsReview')) {\n // createInProgressStatusCheck(context);\n // } else if (\n // toDelete.has('needsReview') ||\n // (prLabels.length === 0 && toAdd.size === 1 && toAdd.has('approved'))\n // ) {\n await updateStatusCheckFromLabels(context, repoContext, pr, prLabels);\n // }\n\n return prLabels;\n};\n","import Webhooks from '@octokit/webhooks';\nimport { Context } from 'probot';\nimport { RepoContext } from '../../context/repoContext';\nimport { autoMergeIfPossible } from './autoMergeIfPossible';\n\nexport const autoApproveAndAutoMerge = async (\n context: Context,\n repoContext: RepoContext,\n): Promise => {\n // const autoMergeLabel = repoContext.labels['merge/automerge'];\n const codeApprovedLabel = repoContext.labels['code/approved'];\n const prLabels = context.payload.pull_request.labels;\n if (prLabels.find((l): boolean => l.id === codeApprovedLabel.id)) {\n await context.github.pulls.createReview(\n context.issue({ event: 'APPROVE' }),\n );\n }\n\n await autoMergeIfPossible(context, repoContext);\n};\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoAssignPRToCreator } from './actions/autoAssignPRToCreator';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\nimport { autoApproveAndAutoMerge } from './actions/autoApproveAndAutoMerge';\n\nexport default function opened(app: Application): void {\n app.on(\n 'pull_request.opened',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const fromRenovate = context.payload.pull_request.head.ref.startsWith(\n 'renovate/',\n );\n\n await Promise.all([\n autoAssignPRToCreator(context, repoContext),\n editOpenedPR(context, repoContext),\n fromRenovate\n ? autoApproveAndAutoMerge(context, repoContext)\n : updateReviewStatus(context, repoContext, 'dev', {\n add: ['needsReview'],\n remove: ['approved', 'changesRequested'],\n }),\n ]);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\nimport { parseBody } from './actions/utils/parseBody';\n\nexport default function closed(app: Application): void {\n app.on(\n 'pull_request.closed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const repo = context.payload.repository;\n const pr = context.payload.pull_request;\n\n if (pr.merged) {\n const parsedBody =\n pr.head.repo.id === repo.id &&\n parseBody(pr.body, repoContext.config.prDefaultOptions);\n const createMergeLockPrFromPr = () => ({\n id: pr.id,\n number: pr.number,\n branch: pr.head.ref,\n });\n await Promise.all([\n repoContext.removeMergeLockedPr(context, createMergeLockPrFromPr()),\n parsedBody && parsedBody.options.deleteAfterMerge\n ? context.github.git\n .deleteRef(context.repo({ ref: `heads/${pr.head.ref}` }))\n .catch(() => {})\n : undefined,\n ]);\n } else {\n await Promise.all([\n updateReviewStatus(context, repoContext, 'dev', {\n remove: ['needsReview'],\n }),\n ]);\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewRequested(app: Application): void {\n app.on(\n 'pull_request.review_requested',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n\n // ignore if sender is self (dismissed review rerequest review)\n if (sender.type === 'Bot') return;\n\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).requested_reviewer;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n const shouldWait = false;\n // repoContext.reviewShouldWait(reviewerGroup, pr.requested_reviewers, { includesWaitForGroups: true });\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup &&\n review.state === 'REQUEST_CHANGES' &&\n // In case this is a rerequest for review\n review.user.login !== reviewer.login,\n );\n\n if (!hasChangesRequestedInReviews) {\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: ['needsReview', !shouldWait && 'requested'],\n remove: ['approved', 'changesRequested'],\n });\n }\n }\n\n if (sender.login === reviewer.login) return;\n\n if (!shouldWait && repoContext.slack) {\n repoContext.slack.postMessage(\n reviewer.login,\n `:eyes: ${repoContext.slack.mention(\n sender.login,\n )} requests your review on ${pr.html_url} !\\n> ${pr.title}`,\n );\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewRequestRemoved(app: Application): void {\n app.on(\n 'pull_request.review_request_removed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).requested_reviewer;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const hasRequestedReviewsForGroup = repoContext.reviewShouldWait(\n reviewerGroup,\n pr.requested_reviewers,\n {\n includesReviewerGroup: true,\n },\n );\n\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n const hasApprovedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'APPROVED',\n );\n\n const approved =\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n hasApprovedInReviews;\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: [\n // if changes requested by the one which requests was removed\n hasChangesRequestedInReviews && 'changesRequested',\n // if was already approved by another member in the group and has no other requests waiting\n approved && 'approved',\n ],\n // remove labels if has no other requests waiting\n remove: [\n approved && 'needsReview',\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n 'requested',\n ],\n });\n }\n\n if (sender.login === reviewer.login) return;\n\n if (repoContext.slack) {\n repoContext.slack.postMessage(\n reviewer.login,\n `:skull_and_crossbones: ${repoContext.slack.mention(\n sender.login,\n )} removed the request for your review on ${pr.html_url}`,\n );\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewSubmitted(app: Application): void {\n app.on(\n 'pull_request_review.submitted',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const pr = context.payload.pull_request;\n const { user: reviewer, state } = (context.payload as any).review;\n if (pr.user.login === reviewer.login) return;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n let merged;\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const hasRequestedReviewsForGroup = repoContext.reviewShouldWait(\n reviewerGroup,\n pr.requested_reviewers,\n {\n includesReviewerGroup: true,\n // TODO reenable this when accepted can notify request review to slack (dev accepted => design requested) and flag to disable for label (approved design ; still waiting for dev ?)\n // includesWaitForGroups: true,\n },\n );\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n const approved =\n !hasRequestedReviewsForGroup &&\n !hasChangesRequestedInReviews &&\n state === 'approved';\n\n const newLabels = await updateReviewStatus(\n context,\n repoContext,\n reviewerGroup,\n {\n add: [\n approved && 'approved',\n state === 'changes_requested' && 'changesRequested',\n ],\n remove: [\n approved && 'needsReview',\n !(\n hasRequestedReviewsForGroup || state === 'changes_requested'\n ) && 'requested',\n state === 'approved' &&\n !hasChangesRequestedInReviews &&\n 'changesRequested',\n state === 'changes_requested' && 'approved',\n ],\n },\n );\n\n if (approved && !hasChangesRequestedInReviews) {\n merged = await autoMergeIfPossible(\n context,\n repoContext,\n pr,\n newLabels,\n );\n }\n }\n\n const mention = repoContext.slack.mention(reviewer.login);\n const prUrl = pr.html_url;\n\n const message = (() => {\n if (state === 'changes_requested') {\n return `:x: ${mention} requests changes on ${prUrl}`;\n }\n if (state === 'approved') {\n return `:clap: :white_check_mark: ${mention} approves ${prUrl}${\n merged ? ' and PR is merged :tada:' : ''\n }`;\n }\n return `:speech_balloon: ${mention} commented on ${prUrl}`;\n })();\n\n repoContext.slack.postMessage(pr.user.login, message);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { updateReviewStatus } from './actions/updateReviewStatus';\n\nexport default function reviewDismissed(app: Application): void {\n app.on(\n 'pull_request_review.dismissed',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n const sender = context.payload.sender;\n const pr = context.payload.pull_request;\n const reviewer = (context.payload as any).review.user;\n\n const reviewerGroup = repoContext.getReviewerGroup(reviewer.login);\n\n if (reviewerGroup && repoContext.config.labels.review[reviewerGroup]) {\n const { data: reviews } = await context.github.pulls.listReviews(\n context.issue({ per_page: 50 }),\n );\n const hasChangesRequestedInReviews = reviews.some(\n (review) =>\n repoContext.getReviewerGroup(review.user.login) ===\n reviewerGroup && review.state === 'REQUEST_CHANGES',\n );\n\n await updateReviewStatus(context, repoContext, reviewerGroup, {\n add: ['needsReview', 'requested'],\n remove: [\n !hasChangesRequestedInReviews && 'changesRequested',\n 'approved',\n ],\n });\n }\n\n if (repoContext.slack) {\n if (sender.login === reviewer.login) {\n repoContext.slack.postMessage(\n pr.user.login,\n `:skull: ${repoContext.slack.mention(\n reviewer.login,\n )} dismissed his review on ${pr.html_url}`,\n );\n } else {\n repoContext.slack.postMessage(\n reviewer.login,\n `:skull: ${repoContext.slack.mention(\n sender.login,\n )} dismissed your review on ${pr.html_url}`,\n );\n }\n }\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestChange } from './utils';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { updateStatusCheckFromLabels } from './actions/updateStatusCheckFromLabels';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function synchronize(app: Application): void {\n app.on(\n 'pull_request.synchronize',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n // old and new sha\n // const { before, after } = context.payload;\n\n await Promise.all([\n editOpenedPR(context, repoContext),\n // addStatusCheckToLatestCommit\n updateStatusCheckFromLabels(context, repoContext),\n // call autoMergeIfPossible to re-add to the queue when push is fixed\n autoMergeIfPossible(context, repoContext),\n ]);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { editOpenedPR } from './actions/editOpenedPR';\nimport { createHandlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function edited(app: Application): void {\n app.on(\n 'pull_request.edited',\n createHandlerPullRequestChange(\n async (context, repoContext): Promise => {\n await editOpenedPR(context, repoContext);\n\n await autoMergeIfPossible(context, repoContext);\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { handlerPullRequestChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\nimport { updateStatusCheckFromLabels } from './actions/updateStatusCheckFromLabels';\nimport { autoApproveAndAutoMerge } from './actions/autoApproveAndAutoMerge';\nimport { updateBody } from './actions/utils/updateBody';\n\nexport default function labelsChanged(app: Application): void {\n app.on(\n ['pull_request.labeled', 'pull_request.unlabeled'],\n async (context) => {\n const sender = context.payload.sender;\n const fromRenovate =\n sender.type === 'Bot' &&\n context.payload.pull_request.head.ref.startsWith('renovate/');\n\n if (sender.type === 'Bot' && !fromRenovate) {\n return;\n }\n\n await handlerPullRequestChange(context, async (repoContext) => {\n if (fromRenovate) {\n return autoApproveAndAutoMerge(context, repoContext);\n }\n\n const label = context.payload.label;\n if (repoContext.protectedLabelIds.includes(label.id)) {\n if (context.payload.action === 'labeled') {\n await context.github.issues.removeLabel(\n context.issue({ name: label.name }),\n );\n } else {\n await context.github.issues.addLabels(\n context.issue({ labels: [label.name] }),\n );\n }\n return;\n }\n\n await updateStatusCheckFromLabels(context, repoContext);\n\n const featureBranchLabel = repoContext.labels['feature-branch'];\n const automergeLabel = repoContext.labels['merge/automerge'];\n\n if (\n (featureBranchLabel && label.id === automergeLabel.id) ||\n (automergeLabel && label.id === automergeLabel.id)\n ) {\n const option: 'featureBranch' | 'autoMerge' =\n featureBranchLabel && label.id === automergeLabel.id\n ? 'featureBranch'\n : 'autoMerge';\n const prBody = context.payload.pull_request.body;\n const { body } = updateBody(\n prBody,\n repoContext.config.prDefaultOptions,\n undefined,\n {\n [option]: context.payload.action === 'labeled',\n },\n );\n\n if (body !== prBody) {\n await context.github.pulls.update(context.issue({ body }));\n }\n } else if (context.payload.action === 'labeled') {\n if (\n repoContext.labels['merge/automerge'] &&\n label.id === repoContext.labels['merge/automerge'].id\n ) {\n await autoMergeIfPossible(context, repoContext);\n }\n }\n });\n },\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestsChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function checkrunCompleted(app: Application): void {\n app.on(\n 'check_run.completed',\n createHandlerPullRequestsChange(\n (context) => context.payload.check_run.pull_requests,\n async (context, repoContext) => {\n await Promise.all(\n context.payload.check_run.pull_requests.map((pr) =>\n context.github.pulls\n .get(\n context.repo({\n number: pr.number,\n }),\n )\n .then((prResult) => {\n return autoMergeIfPossible(context, repoContext, prResult.data);\n }),\n ),\n );\n },\n ),\n );\n}\n","import { Application } from 'probot';\nimport { createHandlerPullRequestsChange } from './utils';\nimport { autoMergeIfPossible } from './actions/autoMergeIfPossible';\n\nexport default function checksuiteCompleted(app: Application): void {\n app.on(\n 'check_suite.completed',\n createHandlerPullRequestsChange(\n (context) => context.payload.check_suite.pull_requests,\n async (context, repoContext) => {\n await Promise.all(\n context.payload.check_suite.pull_requests.map((pr) =>\n context.github.pulls\n .get(\n context.repo({\n number: pr.number,\n }),\n )\n .then((prResult) => {\n return autoMergeIfPossible(context, repoContext, prResult.data);\n }),\n ),\n );\n },\n ),\n );\n}\n","import Webhooks from '@octokit/webhooks';\nimport { Application, Context } from 'probot';\nimport { LockedMergePr } from '../context/repoContext';\nimport { createHandlerPullRequestsChange } from './utils';\n\nconst isSameBranch = (\n context: Context,\n lockedPr: LockedMergePr,\n): boolean => {\n if (!lockedPr) return false;\n return !!context.payload.branches.find((b) => b.name === lockedPr.branch);\n};\n\nexport default function status(app: Application): void {\n app.on(\n 'status',\n createHandlerPullRequestsChange(\n (context, repoContext): LockedMergePr[] => {\n const lockedPr = repoContext.getMergeLockedPr();\n if (!lockedPr) return [];\n\n if (isSameBranch(context, lockedPr)) {\n return [lockedPr];\n }\n\n return [];\n },\n (context, repoContext): void => {\n const lockedPr = repoContext.getMergeLockedPr();\n // check if changed\n if (isSameBranch(context, lockedPr)) {\n repoContext.reschedule(context, lockedPr);\n }\n },\n ),\n );\n}\n","import 'dotenv/config';\nimport { Probot, Application } from 'probot';\nimport openedHandler from './pr-handlers/opened';\nimport closedHandler from './pr-handlers/closed';\nimport reviewRequestedHandler from './pr-handlers/reviewRequested';\nimport reviewRequestRemovedHandler from './pr-handlers/reviewRequestRemoved';\nimport reviewSubmittedHandler from './pr-handlers/reviewSubmitted';\nimport reviewDismissedHandler from './pr-handlers/reviewDismissed';\nimport synchromizeHandler from './pr-handlers/synchronize';\nimport editedHandler from './pr-handlers/edited';\nimport labelsChanged from './pr-handlers/labelsChanged';\nimport checkrunCompleted from './pr-handlers/checkrunCompleted';\nimport checksuiteCompleted from './pr-handlers/checksuiteCompleted';\nimport status from './pr-handlers/status';\n\nif (!process.env.NAME) process.env.NAME = 'reviewflow';\n\n// const getConfig = require('probot-config')\n// const { MongoClient } = require('mongodb');\n\n// const connect = MongoClient.connect(process.env.MONGO_URL);\n// const db = connect.then(client => client.db(process.env.MONGO_DB));\n\n// let config = await getConfig(context, 'reviewflow.yml');\n\n// eslint-disable-next-line import/no-commonjs\nProbot.run((app: Application) => {\n openedHandler(app);\n closedHandler(app);\n reviewRequestedHandler(app);\n reviewRequestRemovedHandler(app);\n\n // app.on('pull_request.closed', async context => {\n\n // });\n\n // app.on('pull_request.reopened', async context => {\n\n // });\n\n reviewSubmittedHandler(app);\n reviewDismissedHandler(app);\n labelsChanged(app);\n synchromizeHandler(app);\n editedHandler(app);\n\n checkrunCompleted(app);\n checksuiteCompleted(app);\n status(app);\n});\n"],"names":["config","slackToken","process","env","ORNIKAR_SLACK_TOKEN","autoAssignToCreator","trimTitle","requiresReviewRequest","prDefaultOptions","featureBranch","autoMerge","deleteAfterMerge","parsePR","title","regExp","error","summary","bot","status","statusInfoFromMatch","match","issue","inBody","url","groups","dev","abarreir","ORNIKAR_EMAIL_DOMAIN","arthurflachs","CorentinAndre","rigma","damienorny","darame07","Pixy","christophehurpeau","HugoGarrido","LentnerStefan","Mxime","tilap","design","jperriere","CoralineColasse","waitForGroups","labels","list","name","color","review","ci","inProgress","succeeded","failed","needsReview","requested","changesRequested","approved","teamConfigs","ornikar","options","optionsRegexps","map","option","regexp","RegExp","optionsLabels","label","commentStart","commentEnd","regexpCols","regexpReviewflowCol","parseOptions","content","defaultConfig","reduce","acc","exec","parseBody","description","reviewFlowCol","reviewflowContent","reviewFlowColMatch","reviewflowContentCol","reviewflowContentColPrefix","reviewflowContentColSuffix","hasFailedStatusOrChecks","context","repoContext","pr","checks","github","listForRef","repo","ref","head","sha","per_page","failedChecks","data","check_runs","filter","check","conclusion","length","log","info","id","combinedStatus","repos","getCombinedStatusForRef","state","failedStatuses","statuses","autoMergeIfPossible","payload","pull_request","prLabels","autoMergeLabel","createMergeLockPrFromPr","number","branch","find","l","debug","removeMergeLockedPr","hasNeedsReview","hasRequestedReview","lockedPr","getMergeLockedPr","pushAutomergeQueue","addMergeLockPr","mergeable","undefined","prResult","pulls","get","pull_number","merged","mergeable_state","reschedule","startsWith","issues","update","body","replace","base","merge","owner","login","parsedBody","mergeResult","merge_method","commit_title","commit_message","Boolean","err","message","initRepoLabels","listLabelsForRepo","finalLabels","labelKey","labelConfig","Object","entries","labelColor","slice","existingLabel","result","createLabel","current_name","updateLabel","getKeys","o","keys","ExcludesFalsy","initTeamSlack","mention","postMessage","Promise","resolve","githubLoginToSlackEmail","groupName","assign","slackClient","WebClient","allUsers","users","limit","members","values","email","member","user","profile","console","warn","im","open","channel","membersMap","Map","getUserFromGithubLogin","githubLogin","text","DRY_RUN","chat","initTeamContext","slackPromise","githubLoginToGroup","forEach","set","getReviewerGroups","githubLogins","Set","getReviewerGroup","reviewShouldWait","reviewerGroup","requestedReviewers","includesReviewerGroup","includesWaitForGroups","requestedReviewerGroups","request","includes","some","group","slack","teamContextsPromise","teamContexts","obtainTeamContext","repository","existingTeamContext","existingPromise","promise","then","teamContext","delete","initRepoContext","create","all","reviewGroupNames","needsReviewLabelIds","key","requestedReviewLabelIds","changesRequestedLabelIds","approvedReviewLabelIds","protectedLabelIds","labelIdToGroupName","reviewGroupLabels","lock","Lock","lockMergePr","automergeQueue","lockPROrPRS","prIdOrIds","callback","reject","createReleaseCallback","release","Error","setTimeout","String","hasChangesRequestedReview","hasApprovesReview","getNeedsReviewGroupNames","shift","p","push","repoContextsPromise","repoContexts","obtainRepoContext","NAME","existingRepoContext","handlerPullRequestChange","createHandlerPullRequestChange","createHandlerPullRequestsChange","getPullRequests","prs","autoAssignPRToCreator","assignees","type","addAssignees","cleanTitle","trim","s","arg1","toLowerCase","toMarkdownOptions","join","toMarkdownInfos","infos","updateBody","updateOptions","parsed","infosParagraph","updatedOptions","editOpenedPR","isPrFromBot","errorRule","rule","date","Date","toISOString","hasLintPrCheck","createStatus","target_url","head_sha","started_at","completed_at","output","featureBranchLabel","automergeLabel","prHasFeatureBranchLabel","prHasAutoMergeLabel","defaultOptions","hasDiffInTitle","hasDiffInBody","removeLabel","addLabels","addStatusCheck","hasPrCheck","created_at","createFailedStatusCheck","updateStatusCheckFromLabels","requested_reviewers","rr","needsReviewGroupNames","updateReviewStatus","reviewGroup","add","labelsToAdd","remove","labelsToRemove","newLabelNames","toAdd","toDelete","getLabelFromKey","reviewConfig","prLabel","existing","newLabelNamesArray","oldLabels","size","replaceLabels","autoApproveAndAutoMerge","codeApprovedLabel","createReview","event","opened","app","on","fromRenovate","closed","git","deleteRef","catch","reviewRequested","sender","reviewer","requested_reviewer","reviews","listReviews","hasChangesRequestedInReviews","html_url","reviewRequestRemoved","hasRequestedReviewsForGroup","hasApprovedInReviews","reviewSubmitted","newLabels","prUrl","reviewDismissed","synchronize","edited","labelsChanged","action","prBody","checkrunCompleted","check_run","pull_requests","checksuiteCompleted","check_suite","isSameBranch","branches","b","Probot","run","openedHandler","closedHandler","reviewRequestedHandler","reviewRequestRemovedHandler","reviewSubmittedHandler","reviewDismissedHandler","synchromizeHandler","editedHandler"],"mappings":";;;;;;;AAEA,MAAMA,MAAgC,GAAG;EACvCC,UAAU,EAAEC,OAAO,CAACC,GAAR,CAAYC,mBADe;EAEvCC,mBAAmB,EAAE,IAFkB;EAGvCC,SAAS,EAAE,IAH4B;EAIvCC,qBAAqB,EAAE,IAJgB;EAKvCC,gBAAgB,EAAE;IAChBC,aAAa,EAAE,KADC;IAEhBC,SAAS,EAAE,KAFK;IAGhBC,gBAAgB,EAAE;GARmB;EAUvCC,OAAO,EAAE;IACPC,KAAK,EAAE,CACL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AjB;EACA8B,mBAAmB,CAAC9B,GAAD,CAAnB;EACAzU,MAAM,CAACyU,GAAD,CAAN;CAtBF"} \ No newline at end of file diff --git a/src/pr-handlers/actions/editOpenedPR.ts b/src/pr-handlers/actions/editOpenedPR.ts index d09a023a0..d84edb768 100644 --- a/src/pr-handlers/actions/editOpenedPR.ts +++ b/src/pr-handlers/actions/editOpenedPR.ts @@ -119,12 +119,21 @@ export const editOpenedPR = async ( ); const featureBranchLabel = repoContext.labels['feature-branch']; + const automergeLabel = repoContext.labels['merge/automerge']; + const prHasFeatureBranchLabel = Boolean( featureBranchLabel && pr.labels.find((label): boolean => label.id === featureBranchLabel.id), ); + + const prHasAutoMergeLabel = Boolean( + automergeLabel && + pr.labels.find((label): boolean => label.id === automergeLabel.id), + ); + const defaultOptions = { ...repoContext.config.prDefaultOptions, + autoMerge: prHasAutoMergeLabel, featureBranch: prHasFeatureBranchLabel, }; @@ -148,17 +157,31 @@ export const editOpenedPR = async ( await context.github.issues.update(context.issue(update)); } - if (options && featureBranchLabel) { - if (prHasFeatureBranchLabel && !options.featureBranch) { - await context.github.issues.removeLabel( - context.issue({ name: featureBranchLabel.name }), - ); + if (options && (featureBranchLabel || automergeLabel)) { + if (featureBranchLabel) { + if (prHasFeatureBranchLabel && !options.featureBranch) { + await context.github.issues.removeLabel( + context.issue({ name: featureBranchLabel.name }), + ); + } + if (options.featureBranch && !prHasFeatureBranchLabel) { + await context.github.issues.addLabels( + context.issue({ labels: [featureBranchLabel.name] }), + ); + } } - if (options.featureBranch && !prHasFeatureBranchLabel) { - await context.github.issues.addLabels( - context.issue({ labels: [featureBranchLabel.name] }), - ); + if (automergeLabel) { + if (prHasAutoMergeLabel && !options.autoMerge) { + await context.github.issues.removeLabel( + context.issue({ name: automergeLabel.name }), + ); + } + if (options.autoMerge && !prHasAutoMergeLabel) { + await context.github.issues.addLabels( + context.issue({ labels: [automergeLabel.name] }), + ); + } } } }; diff --git a/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-simple.ts b/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-simple.ts index e943f436b..a13615f00 100644 --- a/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-simple.ts +++ b/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-simple.ts @@ -14,6 +14,7 @@ If needed, explain here the solution you chose for this #### Options: - [ ] This PR is a feature branch +- [ ] Auto merge when this PR is ready and has no failed statuses. (Also has a queue per repo to prevent multiple useless "Update branch" triggers) - [x] Automatic branch delete after this PR is merged `; diff --git a/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-simpleWithInfos.ts b/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-simpleWithInfos.ts index e8d16d783..1285e1c06 100644 --- a/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-simpleWithInfos.ts +++ b/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-simpleWithInfos.ts @@ -17,6 +17,7 @@ Some informations here, like links. #### Options: - [ ] This PR is a feature branch +- [ ] Auto merge when this PR is ready and has no failed statuses. (Also has a queue per repo to prevent multiple useless "Update branch" triggers) - [x] Automatic branch delete after this PR is merged `; diff --git a/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-table.ts b/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-table.ts index 41702c84c..d0a89eb54 100644 --- a/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-table.ts +++ b/src/pr-handlers/actions/utils/mocks/body/initialAfterEdit-table.ts @@ -16,6 +16,7 @@ If needed, explain here the solution you chose for this #### Options: - [ ] This PR is a feature branch +- [ ] Auto merge when this PR is ready and has no failed statuses. (Also has a queue per repo to prevent multiple useless "Update branch" triggers) - [x] Automatic branch delete after this PR is merged diff --git a/src/pr-handlers/actions/utils/parseBody.test.ts b/src/pr-handlers/actions/utils/parseBody.test.ts index b6d5aed45..1232872e5 100644 --- a/src/pr-handlers/actions/utils/parseBody.test.ts +++ b/src/pr-handlers/actions/utils/parseBody.test.ts @@ -7,6 +7,7 @@ describe('simple', () => { it('should parse default description', () => { const defaultConfig = { featureBranch: false, + autoMerge: false, deleteAfterMerge: true, }; @@ -15,6 +16,7 @@ describe('simple', () => { expect(parsed).not.toBeFalsy(); expect(parsed && parsed.options).toEqual({ featureBranch: false, + autoMerge: false, deleteAfterMerge: true, }); }); @@ -24,6 +26,7 @@ describe('table', () => { it('should parse default description', () => { const defaultConfig = { featureBranch: false, + autoMerge: false, deleteAfterMerge: true, }; @@ -32,6 +35,7 @@ describe('table', () => { expect(parsed).not.toBeFalsy(); expect(parsed && parsed.options).toEqual({ featureBranch: false, + autoMerge: false, deleteAfterMerge: true, }); }); @@ -41,6 +45,7 @@ describe('table', () => { it('should parse edited description', () => { const defaultConfig = { featureBranch: true, + autoMerge: false, deleteAfterMerge: true, }; @@ -49,6 +54,7 @@ describe('table', () => { expect(parsed).not.toBeFalsy(); expect(parsed && parsed.options).toEqual({ featureBranch: false, + autoMerge: false, deleteAfterMerge: true, }); }); diff --git a/src/pr-handlers/actions/utils/prOptions.ts b/src/pr-handlers/actions/utils/prOptions.ts index 8aaf1f007..beb959164 100644 --- a/src/pr-handlers/actions/utils/prOptions.ts +++ b/src/pr-handlers/actions/utils/prOptions.ts @@ -1,6 +1,10 @@ -export type Options = 'featureBranch' | 'deleteAfterMerge'; +export type Options = 'featureBranch' | 'autoMerge' | 'deleteAfterMerge'; -export const options: Options[] = ['featureBranch', 'deleteAfterMerge']; +export const options: Options[] = [ + 'featureBranch', + 'autoMerge', + 'deleteAfterMerge', +]; export const optionsRegexps: { name: Options; regexp: RegExp }[] = options.map( (option) => ({ name: option, @@ -10,6 +14,11 @@ export const optionsRegexps: { name: Options; regexp: RegExp }[] = options.map( export const optionsLabels: { name: Options; label: string }[] = [ { name: 'featureBranch', label: 'This PR is a feature branch' }, + { + name: 'autoMerge', + label: + 'Auto merge when this PR is ready and has no failed statuses. (Also has a queue per repo to prevent multiple useless "Update branch" triggers)', + }, { name: 'deleteAfterMerge', label: 'Automatic branch delete after this PR is merged', diff --git a/src/pr-handlers/actions/utils/updateBody.test.ts b/src/pr-handlers/actions/utils/updateBody.test.ts index ce2065c30..9abe50e3d 100644 --- a/src/pr-handlers/actions/utils/updateBody.test.ts +++ b/src/pr-handlers/actions/utils/updateBody.test.ts @@ -5,32 +5,26 @@ import initialAfterEditSimpleWithInfos from './mocks/body/initialAfterEdit-simpl import initialTable from './mocks/body/initial-table'; import initialAfterEditTable from './mocks/body/initialAfterEdit-table'; +const defaultConfig = { + featureBranch: false, + autoMerge: false, + deleteAfterMerge: true, +}; + describe('simple', () => { it('should update initial description', () => { - const defaultConfig = { - featureBranch: false, - deleteAfterMerge: true, - }; expect(updateBody(initialSimple, defaultConfig).body).toEqual( initialAfterEditSimple, ); }); it('should keep infos on update', () => { - const defaultConfig = { - featureBranch: false, - deleteAfterMerge: true, - }; expect( updateBody(initialAfterEditSimpleWithInfos, defaultConfig).body, ).toEqual(initialAfterEditSimpleWithInfos); }); it('should update options', () => { - const defaultConfig = { - featureBranch: false, - deleteAfterMerge: true, - }; expect( updateBody(initialAfterEditSimpleWithInfos, defaultConfig, undefined, { featureBranch: true, @@ -46,10 +40,6 @@ describe('simple', () => { describe('table', () => { it('should update initial description', () => { - const defaultConfig = { - featureBranch: false, - deleteAfterMerge: true, - }; expect(updateBody(initialTable, defaultConfig).body).toEqual( initialAfterEditTable, ); diff --git a/src/pr-handlers/labelsChanged.ts b/src/pr-handlers/labelsChanged.ts index 555c21f2b..aea08e62b 100644 --- a/src/pr-handlers/labelsChanged.ts +++ b/src/pr-handlers/labelsChanged.ts @@ -39,20 +39,24 @@ export default function labelsChanged(app: Application): void { await updateStatusCheckFromLabels(context, repoContext); + const featureBranchLabel = repoContext.labels['feature-branch']; + const automergeLabel = repoContext.labels['merge/automerge']; + if ( - repoContext.labels['feature-branch'] && - label.id === repoContext.labels['feature-branch'].id + (featureBranchLabel && label.id === automergeLabel.id) || + (automergeLabel && label.id === automergeLabel.id) ) { + const option: 'featureBranch' | 'autoMerge' = + featureBranchLabel && label.id === automergeLabel.id + ? 'featureBranch' + : 'autoMerge'; const prBody = context.payload.pull_request.body; const { body } = updateBody( prBody, - { - featureBranch: false, - deleteAfterMerge: false, - }, + repoContext.config.prDefaultOptions, undefined, { - featureBranch: context.payload.action === 'labeled', + [option]: context.payload.action === 'labeled', }, ); diff --git a/src/teamconfigs/christophehurpeau.ts b/src/teamconfigs/christophehurpeau.ts index bbd062b4e..c509e3f79 100644 --- a/src/teamconfigs/christophehurpeau.ts +++ b/src/teamconfigs/christophehurpeau.ts @@ -6,6 +6,7 @@ const config: Config<'dev'> = { requiresReviewRequest: false, prDefaultOptions: { featureBranch: false, + autoMerge: false, deleteAfterMerge: true, }, parsePR: { diff --git a/src/teamconfigs/ornikar.ts b/src/teamconfigs/ornikar.ts index 620d3d9ff..bd9e0cb27 100644 --- a/src/teamconfigs/ornikar.ts +++ b/src/teamconfigs/ornikar.ts @@ -7,6 +7,7 @@ const config: Config<'dev' | 'design'> = { requiresReviewRequest: true, prDefaultOptions: { featureBranch: false, + autoMerge: false, deleteAfterMerge: true, }, parsePR: {