RFR: 1706: Store github checks in PR unique way [v2]

Guoxiong Li gli at openjdk.org
Fri Feb 10 11:58:47 UTC 2023


On Thu, 9 Feb 2023 22:40:42 GMT, Zhao Song <zsong at openjdk.org> wrote:

>> Currently, checks in GitHub are stored in the commit. So if multiple PRs share the same source commit, then they will compete with the check-runs and store their different checksum in there. This in turn means that all, or most of those PRs will always think the check is outdated when a CheckRun is performed next.
>>  
>> This patch adds repository name and pull request id to the name of check in Github. Therefore, even if multiple PRs share the same source commit, every PR will store a unique check in the commit and there is no competition exists.
>
> Zhao Song has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix problems

bots/pr/src/main/java/org/openjdk/skara/bots/pr/CheckRun.java line 1091:

> 1089:         return pr.repository().forge().name().equals("GitHub") ? "jcheck-" + pr.repository().name() + "-" + pr.id() : "jcheck";
> 1090:     }
> 1091: 

Why does the `GitLab merge request` not need to change such name? I think GitLab also needs.

This method is now put in class `CheckRun` and is used in both `CheckRun` and `CheckWorkItem`. It seems not a good design. We can move the method to the interface `PullRequest` with a default implementation, just like below. Then we can use `pr.getJcheckName()` in both `CheckRun` and `CheckWorkItem`.


// file PullRequest.java
    default String getJcheckName() {
        return "jcheck-" + repository().name() + "-" + id();
    }

-------------

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


More information about the skara-dev mailing list