RFR: 2292: Improve the labels of Review/Commit links for backport branches

Erik Joelsson erikj at openjdk.org
Mon Jul 8 09:43:32 UTC 2024


On Fri, 5 Jul 2024 22:23:48 GMT, Zhao Song <zsong at openjdk.org> wrote:

> The patch is trying to add a branch name to the commit link, review link, commit comment, review comment in JBS.
> 
> Adding a branch name for commit link and comment is feasible and easy, but adding a branch name for review link and review comment is not that easy because people can retarget pull request. Therefore, the bot needs to save the target branch name in the storage.
> 
> I believe my patch will be compatible with the existing storage files.

bots/notify/src/main/java/org/openjdk/skara/bots/notify/PullRequestWorkItem.java line 290:

> 288:             }
> 289:             var storedTargetBranch = storedState.get().targetBranch();
> 290:             if (storedTargetBranch == null || !storedTargetBranch.equals(state.targetBranch())) {

I think we need to flip this check. If `storedTargetBranch` is null and we for some reason get a null from `state.targetBranch()`, then this will keep notifying even though there is no change. If we instead flip it to

state.targetBranch() != null && !state.targetBranch().equals(storedTargetBranch)

then we will only notify if the updated branch is not null. It may never be needed, but it's a bit more defensive against unexpected data being returned from the forge.

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

PR Review Comment: https://git.openjdk.org/skara/pull/1671#discussion_r1668321842


More information about the skara-dev mailing list