Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.

Commit 25277df

Browse files
committed
handle payloads without ref
1 parent 501a475 commit 25277df

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

functions/source/GitPullS3/lambda_function.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ def lambda_handler(event, context):
168168
branch_name = 'master'
169169
repo_name = event['body-json']['project']['path_with_namespace']
170170
except:
171-
branch_name = event['body-json']['ref'].replace('refs/heads/', '')
171+
if 'ref' in event['body-json']:
172+
branch_name = event['body-json']['ref'].replace('refs/heads/', '')
173+
else:
174+
branch_name = 'master'
172175
repo_name = full_name + '/branch/' + branch_name
173176
try:
174177
remote_url = event['body-json']['project']['git_ssh_url']

0 commit comments

Comments
 (0)