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):
36
36
print (f"JWT set as environment variable: JWT={ encoded_jwt } " )
37
37
return encoded_jwt
38
38
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 )
39
56
def main ():
40
57
"""
41
58
to test the code
@@ -51,6 +68,7 @@ def main():
51
68
52
69
# function call
53
70
create_jwt (private_key , app_id )
71
+ make_github_api_request ()
54
72
55
73
if __name__ == "__main__" :
56
74
main ()
Original file line number Diff line number Diff line change 3
3
4
4
5
5
def make_github_api_request ():
6
- url = " https://api.github.com/repositories "
6
+ url = " https://api.github.com/apps "
7
7
headers = {
8
8
"Accept" : "application/vnd.github+json" ,
9
9
"Authorization" : f"Bearer { os .getenv ('GITHUB_JWT' )} " ,
You can’t perform that action at this time.
0 commit comments