@@ -3,10 +3,10 @@ import { readFile, writeFile } from "node:fs/promises"
33import { fileURLToPath , pathToFileURL } from "node:url"
44import { dirname , resolve } from "node:path"
55
6- import { ExecutionResult } from "graphql"
6+ import type { ExecutionResult } from "graphql"
77
88import { graphql } from "./generated/index.ts"
9- import { TypedDocumentString } from "./generated/graphql.ts"
9+ import type { TypedDocumentString } from "./generated/graphql.ts"
1010
1111type RepoRef = `${string } /${string } `
1212
@@ -190,8 +190,9 @@ async function fetchRepoContributors(
190190 break
191191 }
192192
193- if ( defaultBranchRef . target . __typename !== "Commit" ) {
194- throw new Error ( `Invalid typename for ${ owner } /${ repo } ` )
193+ if ( ! ( "history" in defaultBranchRef . target ) ) {
194+ console . warn ( `History not found for ${ owner } /${ repo } ` )
195+ break
195196 }
196197
197198 const history = defaultBranchRef . target . history
@@ -245,20 +246,17 @@ async function execute<TResult, TVariables>(
245246 variables ?: TVariables ,
246247 headers ?: Record < string , string > ,
247248) : Promise < ExecutionResult < TResult > > {
248- const response = await fetch ( "https://graphql.org /graphql/ " , {
249+ const response = await fetch ( "https://api.github.com /graphql" , {
249250 method : "POST" ,
250251 headers : {
251252 "Content-Type" : "application/json" ,
252- Accept : "application/graphql-response+json" ,
253253 ...headers ,
254254 } ,
255- body : JSON . stringify ( {
256- query,
257- variables,
258- } ) ,
255+ body : JSON . stringify ( { query, variables } ) ,
259256 } )
260257
261258 if ( ! response . ok ) {
259+ console . error ( "Network response was not ok:" , response )
262260 throw new Error ( "Network response was not ok" )
263261 }
264262
0 commit comments