Skip to content

Commit

Permalink
feat: add option autoMergeRenovateWithSkipCi, now disabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Aug 5, 2020
1 parent 533d790 commit 09c0353
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/accountConfigs/ornikar.ts
Expand Up @@ -5,6 +5,7 @@ const config: Config<'dev' | 'design', 'ops' | 'frontends' | 'backends'> = {
trimTitle: true,
ignoreRepoPattern: '(infra-.*|devenv)',
requiresReviewRequest: true,
autoMergeRenovateWithSkipCi: true,
prDefaultOptions: {
featureBranch: false,
autoMergeWithSkipCi: false,
Expand Down
1 change: 1 addition & 0 deletions src/accountConfigs/types.ts
Expand Up @@ -64,6 +64,7 @@ export interface Config<GroupNames extends string, TeamNames extends string> {
trimTitle?: boolean;
ignoreRepoPattern?: string;
requiresReviewRequest?: boolean;
autoMergeRenovateWithSkipCi?: boolean;
parsePR: ParsePR;
prDefaultOptions: Options;

Expand Down
21 changes: 16 additions & 5 deletions src/events/pr-handlers/labelsChanged.ts
Expand Up @@ -59,18 +59,29 @@ export default function labelsChanged(
await context.github.pulls.createReview(
contextPr(context, { event: 'APPROVE' }),
);
if (autoMergeSkipCiLabel) {
await context.github.issues.addLabels(

let labels = pr.labels;
const autoMergeWithSkipCi =
autoMergeSkipCiLabel &&
repoContext.config.autoMergeRenovateWithSkipCi;
if (autoMergeWithSkipCi) {
const result = await context.github.issues.addLabels(
contextIssue(context, {
labels: [autoMergeSkipCiLabel.name],
}),
);
labels = result.data;
}
await updateStatusCheckFromLabels(updatedPrContext, pr, context);
await updateStatusCheckFromLabels(
updatedPrContext,
pr,
context,
labels,
);
await updatePrCommentBody(updatedPrContext, context, {
autoMergeWithSkipCi: true,
autoMergeWithSkipCi,
// force label to avoid racing events (when both events are sent in the same time, reviewflow treats them one by one but the second event wont have its body updated)
autoMerge: hasLabelInPR(pr.labels, autoMergeLabel)
autoMerge: hasLabelInPR(labels, autoMergeLabel)
? true
: repoContext.config.prDefaultOptions.autoMerge,
});
Expand Down

0 comments on commit 09c0353

Please sign in to comment.