Skip to content

Add support for Git Projects (Beta/V2) #7

@scacner

Description

@scacner

Project-bot currently only supports Git Projects (classic). After doing some initial setup/testing with a new Git Project, I have been unable to get new Issues to get added to this Project.

I have started looking into possible queries that could be used for getting Project V2 items. Note: These are no longer referred to as cards. Also, columns are no longer referenced. Instead, in Project V2, fields are used. If a column view is used in a Project V2, the columns represent different fields.

One thing to think about will be how to add support for Git Projects (Beta/V2) and continue supporting Git Projects (classic)...

Here are the queries I've been able to use to get Project V2 items in a similar format to the existing queries used by project-bot to get Project cards:

query getAllProjectCardsV2($issueUrl: URI!) {
  resource(url: $issueUrl) {
    ... on Issue {
      id
      repository {
        databaseId
        id
        name
        nameWithOwner
        owner {
          url
          ... on ProjectV2Owner {
            projectsV2(first: 10) { # possibly use query argument for state? #projects(first: 10, states: [OPEN]) {
              nodes {
                title #name
                id
                databaseId
                repositories(first: 50) {
                  totalCount
                  nodes {
                    databaseId
                    id
                    name
                    nameWithOwner
                  }
                }
                items(first: 50) { # Would usually grab the first and last card with a state of NOT_ARCHIVED
                  totalCount
                  nodes {
                    id
                    databaseId
                    content {
                      ... on DraftIssue {
                        title
                        body
                      }
                    }
                    creator {
                      login
                      url
                    }
                    fieldValues(first: 50) {
                      totalCount
                      nodes {
                        ... on ProjectV2ItemFieldValueCommon {
                          id
                          databaseId
                          field {
                            ... on ProjectV2FieldCommon {
                              id
                              databaseId
                              dataType
                              name
                            }
                          }
                        }
                        ... on ProjectV2ItemFieldSingleSelectValue {
                          description
                          name
                        }
                        ... on ProjectV2ItemFieldTextValue {
                          text
                        }
                      }
                    }
                    isArchived
                    type
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

query getCardAndColumnAutomationCardsV2($issueUrl: URI!) {
  resource(url: $issueUrl) {
    ... on Issue {
      projectsV2(first: 10) {
        totalCount
        nodes {
          title #name
          id
          databaseId
          repositories(first: 50) {
            totalCount
            nodes {
              databaseId
              id
              name
              nameWithOwner
            }
          }
          items(first: 50) { # Would usually grab the first and last card with a state of NOT_ARCHIVED
            totalCount
            nodes {
              id
              databaseId
              content {
                ... on DraftIssue {
                  title
                  body
                }
              }
              creator {
                login
                url
              }
              fieldValues(first: 50) {
                totalCount
                nodes {
                  ... on ProjectV2ItemFieldValueCommon {
                    id
                    databaseId
                    field {
                      ... on ProjectV2FieldCommon {
                        id
                        databaseId
                        dataType
                        name
                      }
                    }
                  }
                  ... on ProjectV2ItemFieldSingleSelectValue {
                    description
                    name
                  }
                  ... on ProjectV2ItemFieldTextValue {
                    text
                  }
                }
              }
              isArchived
              type
            }
          }
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions