File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,23 @@ def create_jwt(private_key, app_id):
3636 print (f"JWT set as environment variable: JWT={ encoded_jwt } " )
3737 return encoded_jwt
3838
39+ def make_github_api_request ():
40+ url = " https://api.github.com/apps"
41+ headers = {
42+ "Accept" : "application/vnd.github+json" ,
43+ "Authorization" : f"Bearer { os .getenv ('GITHUB_JWT' )} " ,
44+ "X-GitHub-Api-Version" : "2022-11-28"
45+ }
46+
47+ response = requests .get (url , headers = headers )
48+ response_json = response .json ()
49+
50+ if response .status_code == 200 :
51+ print ("API request successful:" )
52+ print (response_json )
53+ else :
54+ print (f"API request failed with status code { response .status_code } :" )
55+ print (response_json )
3956def main ():
4057 """
4158 to test the code
@@ -51,6 +68,7 @@ def main():
5168
5269 # function call
5370 create_jwt (private_key , app_id )
71+ make_github_api_request ()
5472
5573if __name__ == "__main__" :
5674 main ()
Original file line number Diff line number Diff line change 33
44
55def make_github_api_request ():
6- url = " https://api.github.com/repositories "
6+ url = " https://api.github.com/apps "
77 headers = {
88 "Accept" : "application/vnd.github+json" ,
99 "Authorization" : f"Bearer { os .getenv ('GITHUB_JWT' )} " ,
You can’t perform that action at this time.
0 commit comments