5
5
import requests
6
6
7
7
8
- def create_jwt (pem_path , app_id ):
8
+ def create_jwt (private_key , app_id ):
9
9
"""
10
10
function to create JWT from GitHub app id and pvt key
11
- :param pem_path :
11
+ :param private_key :
12
12
:param app_id:
13
13
:return:
14
14
"""
15
15
# Open PEM
16
- with open (pem_path , 'rb' ) as pem_file :
17
- signing_key = jwk_from_pem (pem_file .read ())
16
+ # with open(pem_path, 'rb') as pem_file:
17
+ # signing_key = jwk_from_pem(pem_file.read())
18
+ signing_key = jwk_from_pem (private_key .encode ('utf-8' ))
18
19
19
20
payload = {
20
21
# Issued at time
@@ -41,15 +42,15 @@ def main():
41
42
:return:
42
43
"""
43
44
parser = argparse .ArgumentParser (description = "Create JWT for GitHub App authentication" )
44
- parser .add_argument ("--pem_path " ,required = True , type = str , help = "Path to the private PEM file " )
45
- parser .add_argument ("--app_id " ,required = True , type = str , help = "Your GitHub App ID" )
45
+ parser .add_argument ("--github_app_private_key " ,required = True , type = str , help = "Github App Private key " )
46
+ parser .add_argument ("--github_app_id " ,required = True , type = str , help = "Your GitHub App ID" )
46
47
args = parser .parse_args ()
47
48
48
- pem_path = args .pem_path
49
+ private_key = args .github_app_private_key
49
50
app_id = args .app_id
50
51
51
52
# function call
52
- create_jwt (pem_path , app_id )
53
+ create_jwt (private_key , app_id )
53
54
54
55
if __name__ == "__main__" :
55
56
main ()
0 commit comments