@@ -68,16 +68,17 @@ def get_endpoint():
6868 # see https://github.com/actions/checkout/blob/44c2b7a8a4ea60a981eaca3cf939b5f4305c123b/src/git-auth-helper.ts#L56-L63
6969 auth = git ("config" , f"http.{ url .scheme } ://{ url .netloc } /.extraheader" )
7070 endpoint .update_headers (get_env (auth , sep = ": " ))
71- if "GITHUB_TOKEN" in os .environ :
72- endpoint .headers ["Authorization" ] = f"token { os .environ ['GITHUB_TOKEN' ]} "
7371 if "Authorization" not in endpoint .headers :
74- # last chance: use git credentials (possibly backed by a credential helper like the one installed by gh)
75- # see https://git-scm.com/docs/git-credential
76- credentials = get_env (git ("credential" , "fill" , check = True ,
77- # drop leading / from url.path
78- input = f"protocol={ url .scheme } \n host={ url .netloc } \n path={ url .path [1 :]} \n " ))
79- auth = base64 .b64encode (f'{ credentials ["username" ]} :{ credentials ["password" ]} ' .encode ()).decode ('ascii' )
80- endpoint .headers ["Authorization" ] = f"Basic { auth } "
72+ if "GITHUB_TOKEN" in os .environ :
73+ endpoint .headers ["Authorization" ] = f"token { os .environ ['GITHUB_TOKEN' ]} "
74+ else :
75+ # last chance: use git credentials (possibly backed by a credential helper like the one installed by gh)
76+ # see https://git-scm.com/docs/git-credential
77+ credentials = get_env (git ("credential" , "fill" , check = True ,
78+ # drop leading / from url.path
79+ input = f"protocol={ url .scheme } \n host={ url .netloc } \n path={ url .path [1 :]} \n " ))
80+ auth = base64 .b64encode (f'{ credentials ["username" ]} :{ credentials ["password" ]} ' .encode ()).decode ('ascii' )
81+ endpoint .headers ["Authorization" ] = f"Basic { auth } "
8182 return endpoint
8283
8384
0 commit comments