Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csr: add logging #503

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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());
}
}
}