diff --git a/scripts/fetch-pr-artifacts.ts b/scripts/fetch-pr-artifacts.ts index 4558bf08..595881fc 100755 --- a/scripts/fetch-pr-artifacts.ts +++ b/scripts/fetch-pr-artifacts.ts @@ -52,7 +52,9 @@ export async function find_pr(repo: string, ref: string): Promise(prQuery(repo)) const node = res.repository?.ref?.target?.history?.edges.find(n => n.node.oid === ref) - return node?.node.associatedPullRequests.nodes[0].number + const nodes = node?.node.associatedPullRequests.nodes + if (!nodes || nodes.length === 0) return + return nodes[0].number } async function queryGraphQL(query: string): Promise {