@@ -38,7 +38,7 @@ export default {
3838} ;
3939
4040async function handleTokenRequest ( request : Request , env : Env ) : Promise < Response > {
41- // ── 1. Extract OIDC token ──────────────────────────────────────────────────
41+ // 1. Extract OIDC token
4242 const authHeader = request . headers . get ( "Authorization" ) ;
4343 if ( ! authHeader ?. startsWith ( "Bearer " ) ) {
4444 return jsonError (
@@ -48,7 +48,7 @@ async function handleTokenRequest(request: Request, env: Env): Promise<Response>
4848 }
4949 const oidcToken = authHeader . slice ( "Bearer " . length ) ;
5050
51- // ── 2. Verify GitHub OIDC token ───────────────────────────────────────────
51+ // 2. Verify GitHub OIDC token
5252 // The expected audience is the URL of this worker itself.
5353 // The GitHub Action must request its OIDC token with this URL as the audience.
5454 const workerOrigin = new URL ( request . url ) . origin ;
@@ -70,7 +70,7 @@ async function handleTokenRequest(request: Request, env: Env): Promise<Response>
7070 const owner = repository . slice ( 0 , slashIdx ) ;
7171 const repo = repository . slice ( slashIdx + 1 ) ;
7272
73- // ── 3. Create GitHub App JWT ───────────────────────────────────────────────
73+ // 3. Create GitHub App JWT
7474 let appJwt : string ;
7575 try {
7676 appJwt = await createAppJwt ( env . GITHUB_APP_PRIVATE_KEY , env . GITHUB_APP_ID ) ;
@@ -79,7 +79,7 @@ async function handleTokenRequest(request: Request, env: Env): Promise<Response>
7979 return jsonError ( "Internal error: failed to create App JWT" , 500 ) ;
8080 }
8181
82- // ── 4. Look up the App installation for this repository ───────────────────
82+ // 4. Look up the App installation for this repository
8383 let installationId : number ;
8484 try {
8585 installationId = await getInstallationId ( appJwt , owner , repo ) ;
@@ -96,7 +96,7 @@ async function handleTokenRequest(request: Request, env: Env): Promise<Response>
9696 return jsonError ( "Failed to look up GitHub App installation" , 500 ) ;
9797 }
9898
99- // ── 5. Create an installation access token ────────────────────────────────
99+ // 5. Create an installation access token
100100 let tokenData : { token : string ; expires_at : string } ;
101101 try {
102102 tokenData = await createInstallationToken ( appJwt , installationId ) ;
@@ -113,7 +113,7 @@ async function handleTokenRequest(request: Request, env: Env): Promise<Response>
113113 } ) ;
114114}
115115
116- // ── GitHub OIDC helpers ────────────────────────────────────────────────────────
116+ // GitHub OIDC helpers
117117
118118/**
119119 * Verify a GitHub Actions OIDC JWT.
@@ -137,7 +137,7 @@ async function verifyGitHubOIDCToken(
137137 return payload as Record < string , unknown > ;
138138}
139139
140- // ── GitHub App JWT helpers ─────────────────────────────────────────────────────
140+ // GitHub App JWT helpers
141141
142142/**
143143 * Create a short-lived GitHub App JWT for authenticating App-level API calls.
@@ -215,7 +215,7 @@ async function createInstallationToken(
215215 return ( await response . json ( ) ) as { token : string ; expires_at : string } ;
216216}
217217
218- // ── Utility ────────────────────────────────────────────────────────────────────
218+ // Utility
219219
220220function jsonError ( message : string , status : number ) : Response {
221221 return Response . json ( { error : message } , { status } ) ;
0 commit comments