RFR: 1188: The pr/NNNN branches are not always deleted when a PR is closed

Guoxiong Li gli at openjdk.java.net
Sun Nov 21 14:59:55 UTC 2021


Hi all,

When a PR is ready for reviewing, the label `rfr` will be added and skara will create the branch `pr/NNNN` for it. 
If we convert the PR back to draft, the label `rfr` would be removed and the branch `pr/NNNN` won't be deleted. 
Then we close the PR, **the bot won't deleted the branch**.

The reason is that the following code checks the label `rfr` or `integrated` to decide whether the bot should remove the branch.


    private boolean isOfInterest(PullRequest pr) {
        var labels = new HashSet<>(pr.labelNames());
        if (!(labels.contains("rfr") || labels.contains("integrated"))) {
            log.fine("PR is not yet ready - needs either 'rfr' or 'integrated' label");
            return false;
        }
        // ignore......
    }


To solve this issue, this patch adds one situation about the branch existing or not. And the corresponding test is added.

Thanks for taking the time to review.

Best Regards,
-- Guoxiong

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

Commit messages:
 - 1188: The pr/NNNN branches are not always deleted when a PR is closed

Changes: https://git.openjdk.java.net/skara/pull/1242/files
 Webrev: https://webrevs.openjdk.java.net/?repo=skara&pr=1242&range=00
  Issue: https://bugs.openjdk.java.net/browse/SKARA-1188
  Stats: 61 lines in 2 files changed: 58 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/skara/pull/1242.diff
  Fetch: git fetch https://git.openjdk.java.net/skara pull/1242/head:pull/1242

PR: https://git.openjdk.java.net/skara/pull/1242


More information about the skara-dev mailing list