RFR: 1393: PR bot fails on missing .jcheck/conf

Erik Joelsson erikj at openjdk.org
Mon Oct 31 22:55:49 UTC 2022

On Mon, 31 Oct 2022 22:09:06 GMT, Zhao Song <zsong at openjdk.org> wrote:

> SKARA-1393 describes a problem related with `.jcheck/conf` missing.
> In this patch, when the problem happens, the author of this pull request will get instructions about how to solve this problem.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java line 231:

> 229:             //check whether this repo contains .jcheck/conf, if not, let the pr author to notify the repo owner
> 230:             try {
> 231:                 pr.repository().fileContents(".jcheck/conf", pr.targetRef());

Instead of explicitly checking for `.jcheck/conf` here through a remote call, I think it would be better to react to if the `Optional<CensusInstance>` below comes back empty or not. If it's empty and `bot.confOverrideRepository().isEmpty()` then you can print a message.

bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckWorkItem.java line 239:

> 237:                 if (!messageSent) {
> 238:                     pr.addComment(message);
> 239:                 }

I think you can reuse the method `addBackportErrorComment` for posting the comment. There is nothing specific to backport about that method, so it should just be renamed to `addErrorComment`. 

For the message, I don't think we need to tell the user to close the PR. I think we should add the ⚠ emoji first in the message. I would suggest something like this:

"⚠ at user The target branch of this pull request is either missing `.jcheck/conf` or it is invalid. Until that is resolved, this pull request cannot be processed. Please notify the repository owner."


PR: https://git.openjdk.org/skara/pull/1407

More information about the skara-dev mailing list