Skip to content

Commit

Permalink
fix: remove needsReview label for auto aproved renovate prs
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Dec 20, 2020
1 parent 6ed428e commit 4144c8b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
10 changes: 9 additions & 1 deletion dist/index-node12-dev.cjs.js

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

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

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion dist/index-node12.cjs.js

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

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

Large diffs are not rendered by default.

27 changes: 21 additions & 6 deletions src/events/pr-handlers/labelsChanged.ts
Expand Up @@ -4,6 +4,7 @@ import type { AppContext } from '../../context/AppContext';
import { autoMergeIfPossible } from './actions/autoMergeIfPossible';
import { updateBranch } from './actions/updateBranch';
import { updatePrCommentBodyOptions } from './actions/updatePrCommentBody';
import { updateReviewStatus } from './actions/updateReviewStatus';
import { updateStatusCheckFromLabels } from './actions/updateStatusCheckFromLabels';
import hasLabelInPR from './actions/utils/hasLabelInPR';
import { createPullRequestHandler } from './utils/createPullRequestHandler';
Expand Down Expand Up @@ -49,6 +50,7 @@ export default function labelsChanged(
const label = (context.payload as any).label;
if (fromRenovate) {
const codeApprovedLabel = repoContext.labels['code/approved'];
const codeNeedsReviewLabel = repoContext.labels['code/needs-review'];
const autoMergeLabel = repoContext.labels['merge/automerge'];
const autoMergeSkipCiLabel = repoContext.labels['merge/skip-ci'];
if (context.payload.action === 'labeled') {
Expand All @@ -73,12 +75,25 @@ export default function labelsChanged(
);
labels = result.data;
}
await updateStatusCheckFromLabels(
updatedPr,
context,
repoContext,
labels,
);
if (hasLabelInPR(labels, codeNeedsReviewLabel)) {
await updateReviewStatus(
updatedPr,
context,
repoContext,
'dev',
{
remove: ['needsReview'],
},
);
} else {
await updateStatusCheckFromLabels(
updatedPr,
context,
repoContext,
labels,
);
}

await updatePrCommentBodyOptions(
context,
repoContext,
Expand Down

0 comments on commit 4144c8b

Please sign in to comment.