55import requests
66
77
8- def create_jwt (pem_path , app_id ):
8+ def create_jwt (private_key , app_id ):
99 """
1010 function to create JWT from GitHub app id and pvt key
11- :param pem_path :
11+ :param private_key :
1212 :param app_id:
1313 :return:
1414 """
1515 # 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' ))
1819
1920 payload = {
2021 # Issued at time
@@ -41,15 +42,15 @@ def main():
4142 :return:
4243 """
4344 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" )
4647 args = parser .parse_args ()
4748
48- pem_path = args .pem_path
49+ private_key = args .github_app_private_key
4950 app_id = args .app_id
5051
5152 # function call
52- create_jwt (pem_path , app_id )
53+ create_jwt (private_key , app_id )
5354
5455if __name__ == "__main__" :
5556 main ()
0 commit comments