Skip to content

Commit

Permalink
fix: labels for status check when approve pr
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Nov 12, 2018
1 parent 0e095cf commit b06a942
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/context/repoContext.js
Expand Up @@ -10,6 +10,7 @@ const initRepoContext = async (context, config) => {
const repoContext = Object.create(teamContext);

const labels = await initRepoLabels(context, config);
const labelsValues = Object.values(labels);
const needsReviewLabelIds = Object.keys(config.labels.review)
.map((key) => config.labels.review[key].needsReview)
.filter(Boolean)
Expand Down Expand Up @@ -68,7 +69,7 @@ const initRepoContext = async (context, config) => {
labels = context.payload.pull_request.labels || []
) => {
context.log.info('updateStatusCheckFromLabels', {
labels,
labels: labels.map((l) => l.name),
hasNeedsReview: hasNeedsReview(labels),
hasApprovesReview: hasApprovesReview(labels),
});
Expand Down Expand Up @@ -140,7 +141,12 @@ const initRepoContext = async (context, config) => {
if (toAdd.has('needsReview')) {
createInProgressStatusCheck(context);
} else if (toDelete.has('needsReview')) {
updateStatusCheckFromLabels(context, [...newLabels]);
updateStatusCheckFromLabels(
context,
[...newLabels].map((labelName) =>
labelsValues.find((l) => l.name === labelName)
)
);
}
},

Expand Down

0 comments on commit b06a942

Please sign in to comment.