Skip to content
Permalink
Browse files
csr: add logging
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Mar 9, 2020
1 parent 9f69a8b commit 1b19054e4a855648d99ff6931a4606d7148f5e62
Showing 1 changed file with 17 additions and 4 deletions.
@@ -102,20 +102,33 @@ public void run(Path scratchPath) {
var csr = link.issue().orElseThrow(
() -> new IllegalStateException("Link with title 'csr for' does not contain issue")
);

log.info("CSR for " + describe(pr) + " has id " + csr.id());

var resolution = csr.properties().get("resolution");
if (resolution == null || resolution.isNull()) {
log.info("CSR issue resolution is null for " + describe(pr) + ", not removing CSR label");
continue;
}
var name = resolution.get("name");
if (name == null || name.isNull()) {
log.info("CSR issue resolution name is null for " + describe(pr) + ", not removing CSR label");
continue;
}

if (csr.state() == Issue.State.CLOSED && name.asString().equals("Approved")) {
log.info("CSR closed and approved for " + repo.name() + "#" + pr.id() + ", removing csr label");
pr.removeLabel(CSR_LABEL);
hasCSRLabel.remove(pr.id());
if (csr.state() != Issue.State.CLOSED) {
log.info("CSR issue state is not closed for " + describe(pr) + ", not removing CSR label");
continue;
}

if (!name.asString().equals("Approved")) {
log.info("CSR issue resolution is not 'Approved' for " + describe(pr) + ", not removing CSR label");
continue;
}

log.info("CSR closed and approved for " + describe(pr) + ", removing CSR label");
pr.removeLabel(CSR_LABEL);
hasCSRLabel.remove(pr.id());
}
}
}

0 comments on commit 1b19054

Please sign in to comment.