Skip to content

Commit a78e021

Browse files
committed
Update handler.py
1 parent 575fdfd commit a78e021

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/handler.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,25 @@ def handler(event):
5151
- Starts a runner
5252
'''
5353

54+
event_input = event.get('input')
55+
5456
# Get PAT
55-
if event.get('github_pat', None) is not None:
56-
pat = event.get('github_pat')
57-
event.pop('github_pat', None)
57+
if event_input.get('github_pat', None) is not None:
58+
pat = event_input.get('github_pat')
59+
event_input.pop('github_pat', None)
5860
elif os.environ.get("GITHUB_PAT", None) is not None:
5961
pat = os.environ.get("GITHUB_PAT")
6062
else:
6163
raise Exception("Missing GitHub Personal Access Token")
6264

6365
# Get ORG
64-
if event.get('github_org', None) is not None:
65-
org = event.get('github_org')
66-
event.pop('github_org', None)
66+
if event_input.get('github_org', None) is not None:
67+
org = event_input.get('github_org')
68+
event_input.pop('github_org', None)
6769
elif os.environ.get("GITHUB_ORG", None) is not None:
6870
org = os.environ.get("GITHUB_ORG")
71+
else:
72+
raise Exception("Missing GitHub Organization")
6973

7074
# Configure runner
7175
config_cmd = f'./actions-runner/config.sh --url https://github.com/{org} --token {get_token(pat, org)} --name {RUNNER_NAME} --work _work --labels runpod'
@@ -79,7 +83,7 @@ def handler(event):
7983
for var in unwated_env_vars:
8084
runner_env.pop(var, None)
8185

82-
runner_env['JOB_INPUT'] = str(event['input'])
86+
runner_env['JOB_INPUT'] = str(event_input)
8387

8488
# Start runner
8589
start_cmd = './actions-runner/run.sh --once'

0 commit comments

Comments
 (0)