File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed
Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,6 @@ export class ConfigProvider {
33
44 get githubToken ( ) {
55 return this . #githubToken ??
6- ( this . #githubToken = getEnvOrThrow ( "GITHUB_TOKEN" ) ) ;
6+ ( this . #githubToken = Deno . env . get ( "GITHUB_TOKEN" ) ) ;
77 }
88}
9-
10- function getEnvOrThrow ( name : string ) {
11- const value = Deno . env . get ( name ) ;
12- if ( ! value ) {
13- throw new Error ( `Requires definition of env var: ${ name } ` ) ;
14- }
15- return value ;
16- }
Original file line number Diff line number Diff line change @@ -44,19 +44,22 @@ export type GitHubApiClient = ExtractInterface<RealGitHubApiClient>;
4444
4545export class RealGitHubApiClient {
4646 readonly #fileFetcher: FileFetcher ;
47- readonly #token: string ;
47+ readonly #token: string | undefined ;
4848
49- constructor ( fileFetcher : FileFetcher , token : string ) {
49+ constructor ( fileFetcher : FileFetcher , token : string | undefined ) {
5050 this . #fileFetcher = fileFetcher ;
5151 this . #token = token ;
5252 }
5353
5454 #getHeaders( ) : HeadersInit {
55- return {
55+ const obj : Record < string , string > = {
5656 "Accept" : "application/vnd.github+json" ,
5757 "X-GitHub-Api-Version" : "2022-11-28" ,
58- "Authorization" : `Bearer ${ this . #token} ` ,
5958 } ;
59+ if ( this . #token) {
60+ obj [ "Authorization" ] = `Bearer ${ this . #token} ` ;
61+ }
62+ return obj ;
6063 }
6164
6265 async listWorkflowRuns (
You can’t perform that action at this time.
0 commit comments