Delete Stale MR Branches and close MRs with external/missing branches (Step 2 part 2)
Overview
- Run a script to do the following for all open MRs which still have the "stale" label:
- Delete the branches which are in the
www-gitlab-com
repo. This will cause their MRs to automatically be closed. - Directly close any which have branches on forks (non
www-gitlab-com
repo). These are external contributions, and their branches cannot (and should not) be deleted. - Directly close any for which the associated branch does not exist anymore (this is possible).
- Delete the branches which are in the
This is the last part of "Step 2" in #5525 (closed)
Dev Notes
Here's a GraphQL query to retrieve MRs with labels. Unfortunately, the GitLab GraphQL API does not provide a way to filter queries by values (e.g. label title: "stale - to be closed"
) - at least not the labels
resource. It doesn't even allow you to filter on iid
via mergeRequest(iid: "123")
or mergeRequests(iids: ["123", "456"])
- this gives a backend error. We should open issues against the API for this.
{
project(fullPath: "gitlab-com/www-gitlab-com") {
mergeRequests {
nodes {
id
iid
state
updatedAt
sourceBranch
labels {
nodes {
title
}
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
Closed MRs with Fork Branches
Here is an except of the script run log output showing which MRs with fork branches (i.e. external contributors) were closed. This is just a subset of the entire log, which can't be included because it might contain data from confidential issues.
closed-mrs-with-fork-branches.txt
Related Issues
references #5525 (closed)