Merge pull request #9007 from babakks/8960-add-projectsV2-field

Add `projectsV2` to JSON fields of `gh repo` commands
This commit is contained in:
Andy Feller 2024-04-29 07:52:51 -04:00 committed by GitHub
commit f9f4c99010
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 0 deletions

View file

@ -23,6 +23,7 @@ type ProjectV2 struct {
Number int `json:"number"`
ResourcePath string `json:"resourcePath"`
Closed bool `json:"closed"`
URL string `json:"url"`
}
// UpdateProjectV2Items uses the addProjectV2ItemById and the deleteProjectV2Item mutations

View file

@ -124,6 +124,9 @@ type Repository struct {
Projects struct {
Nodes []RepoProject
}
ProjectsV2 struct {
Nodes []ProjectV2
}
// pseudo-field that keeps track of host name of this repo
hostname string

View file

@ -442,6 +442,7 @@ var RepositoryFields = []string{
"assignableUsers",
"mentionableUsers",
"projects",
"projectsV2",
// "branchProtectionRules", // too complex to expose
// "collaborators", // does it make sense to expose without affiliation filter?
@ -487,6 +488,8 @@ func RepositoryGraphQL(fields []string) string {
q = append(q, "mentionableUsers(first:100){nodes{id,login,name}}")
case "projects":
q = append(q, "projects(first:100,states:OPEN){nodes{id,name,number,body,resourcePath}}")
case "projectsV2":
q = append(q, "projectsV2(first:100,query:\"is:open\"){nodes{id,number,title,resourcePath,closed,url}}")
case "watchers":
q = append(q, "watchers{totalCount}")
case "issues":