Using GraphQL via GitLab to discover the first commit of a file in a repository
I am using GraphQL to access the contents of a .repository hosted in GitLab. I need specific information about the files in a repository. Specifically when it was last modified and when it was created.
Using GraphQL to get the last commit information about a file is fairly straight forward:
query($projectPath: ID!, $filePath :String){project(Path: $projectPath) {
>repository {
>tree(path: $filePath) {
>lastCommit {
>author {
>name
>}
>committerEmail
>committedDate
>}
>}
>}}}{"fullPath":"my/path", "filePath": "myfile.txt"}
What I need is the first commit of a file, so that I can return the creation date of the file. So far, the Graphql schema in GitLab doesn’t seem to cover this.
Any suggestions would be most welcome.
Read more here: Source link
