Extended Repository gql type with CODEOWNERS path
What does this MR do and why?
The MR extends the GraphQL schema with codeOwnersPath
field on the Repository. The field takes one optional argument - branch_name
to return correct path to the CODEOWNERS
file in a particular branch since the file's location might differ in different branches.
How to set up and validate locally
- Go to a project in your local GDK and add (or make sure it exists) the
CODEOWNERS
file at one of the pre-defined places:
- project's root,
-
docs/
, or .gitlab/
- Create a new branch by removing this newly-created file. The new branch should not contain
CODEOWNERS
- Add the new
CODEOWNERS
in this new branch, but in a place other than at step 1. - Open
graphql-explorer
(at/-/graphql-explorer
in your local GDK) and add the following data:
Query:
query getCodeOwnersPathInfo($projectPath: ID!, $branchName: String!) {
project(fullPath: $projectPath) {
repository {
codeOwnersPath(branchName: $branchName)
}
}
}
Query variables:
{
"projectPath": YOUR_PROJECT_PATH, // for example, `"flightjs/Flight"`
"branchName": ONE_OF_THE_TWO // for example, `master`
}
In the variables, projectPath
will be the unchanged,
- Run the query with the name of the branch from p.1 assigned to
branchName
. Make sure thecodeOwnersPath
is returned with the correct path for that branch - Change
branchName
to the name of the branch from p.3 and run the query again. Make sure thecodeOwnersPath
is changed and is returned with the correct path for that second branch
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #389419 (closed)
Edited by Denys Mishunov