Skip to content

Commit 68084bb

Browse files
cororected action repo name DEVOPS-46
1 parent cde494a commit 68084bb

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

generate_jwt.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
import 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

5455
if __name__ == "__main__":
5556
main()

0 commit comments

Comments
 (0)