From a4643cf0d86eee39b0fa18db094067d74ff6e71e Mon Sep 17 00:00:00 2001 From: David Sanders Date: Thu, 24 Aug 2023 15:20:57 -0700 Subject: [PATCH] feat: support pull requests --- src/update-project.ts | 65 ++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/src/update-project.ts b/src/update-project.ts index 9452d58..7f45520 100644 --- a/src/update-project.ts +++ b/src/update-project.ts @@ -21,6 +21,35 @@ export async function fetchContentMetadata( ): Promise { const result: GraphQlQueryResponseData = await octokit.graphql( ` + fragment ProjectItemFields on ProjectV2Item { + id + project { + number + owner { + ... on Organization { + login + } + ... on User { + login + } + } + } + field: fieldValueByName(name: $fieldName) { + ... on ProjectV2ItemFieldSingleSelectValue { + value: name + } + ... on ProjectV2ItemFieldNumberValue { + value: number + } + ... on ProjectV2ItemFieldTextValue { + value: text + } + ... on ProjectV2ItemFieldDateValue { + value: date + } + } + } + query result($contentId: ID!, $fieldName: String!) { node(id: $contentId) { ... on Issue { @@ -28,32 +57,16 @@ export async function fetchContentMetadata( title projectItems(first: 100) { nodes { - id - project { - number - owner { - ... on Organization { - login - } - ... on User { - login - } - } - } - field: fieldValueByName(name: $fieldName) { - ... on ProjectV2ItemFieldSingleSelectValue { - value: name - } - ... on ProjectV2ItemFieldNumberValue { - value: number - } - ... on ProjectV2ItemFieldTextValue { - value: text - } - ... on ProjectV2ItemFieldDateValue { - value: date - } - } + ...ProjectItemFields + } + } + } + ... on PullRequest { + id + title + projectItems(first: 100) { + nodes { + ...ProjectItemFields } } }