From bc5c9583b50d293104031af659d563aae06ff5d5 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Fri, 17 Feb 2017 13:11:31 +0100 Subject: [PATCH] Remove 'needs rebase' and 'needs work' on new push --- source/dlangbot/app.d | 4 +++- source/dlangbot/github.d | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/dlangbot/app.d b/source/dlangbot/app.d index c5c8b9a..e2014ba 100644 --- a/source/dlangbot/app.d +++ b/source/dlangbot/app.d @@ -181,7 +181,9 @@ void handlePR(string action, PullRequest pr) return; if (action == "synchronize") { - checkAndRemoveMergeLabels(labelsAndCommits.labels, pr); + enum toRemoveLabels = ["auto-merge", "auto-merge-squash", + "needs rebase", "needs work"]; + checkAndRemoveLabels(labelsAndCommits.labels, pr, toRemoveLabels); if (labelsAndCommits.commits !is null) commits = labelsAndCommits.commits; } diff --git a/source/dlangbot/github.d b/source/dlangbot/github.d index 99d9e70..7470b53 100644 --- a/source/dlangbot/github.d +++ b/source/dlangbot/github.d @@ -229,11 +229,11 @@ Json[] tryMerge(in ref PullRequest pr, MergeMethod method) return commits; } -void checkAndRemoveMergeLabels(Json[] labels, in ref PullRequest pr) +void checkAndRemoveLabels(Json[] labels, in ref PullRequest pr, in string[] toRemoveLabels) { labels .map!(l => l["name"].get!string) - .filter!(n => n.startsWith("auto-merge")) + .filter!(n => toRemoveLabels.canFind(n)) .each!(l => pr.removeLabel(l)); }