File tree 1 file changed +7
-10
lines changed 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -57,29 +57,26 @@ export async function fetchWithReport(url, init) {
57
57
}
58
58
59
59
export async function fetchGithubRestAPI ( url , init = { } ) {
60
+ const token = process . env . GITHUB_TOKEN ;
61
+ assert . ok ( typeof token === "string" && token . length > 0 , "GITHUB_TOKEN is missing" ) ;
62
+
60
63
return fetchWithReport ( url , {
61
64
...init ,
62
65
headers : {
63
66
Accept : "application/vnd.github+json" ,
64
- Authorization : `Bearer ${ process . env . GITHUB_TOKEN } ` ,
67
+ Authorization : `Bearer ${ token } ` ,
65
68
"X-GitHub-Api-Version" : "2022-11-28" ,
66
69
...init . headers
67
70
}
68
71
} ) ;
69
72
}
70
73
71
- export async function await200 ( url = "http://localhost :8080" , attempts = 50 ) {
74
+ export async function await200 ( url = "http://127.0.0.1 :8080" , attempts = 50 ) {
72
75
let n = 0 ;
73
76
while ( ++ n <= attempts ) {
74
77
console . log ( c . cyan ( `GET ${ url } ${ n } ` ) ) ;
75
- let response ;
76
- try {
77
- response = await fetch ( url ) ;
78
- } catch {
79
- // ignore
80
- }
81
-
82
- const { ok, status } = response ?? { } ;
78
+ const response = await fetch ( url ) ;
79
+ const { ok, status } = response ;
83
80
84
81
if ( ok && status === 200 ) {
85
82
console . log ( c . green ( `200 OK, continue` ) ) ;
You can’t perform that action at this time.
0 commit comments