This repository was archived by the owner on Oct 4, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
functions/source/GitPullS3 Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ def lambda_handler(event, context):
173173 try :
174174 # BitBucket server
175175 full_name = event ['body-json' ]['repository' ]['name' ]
176- except KeyError :
176+ except KeyError :
177177 # BitBucket pull-request
178178 full_name = event ['body-json' ]['pullRequest' ]['fromRef' ]['repository' ]['name' ]
179179 if not secure :
@@ -189,8 +189,12 @@ def lambda_handler(event, context):
189189 try :
190190 # branch names should contain [name] only, tag names - "tags/[name]"
191191 branch_name = event ['body-json' ]['ref' ].replace ('refs/heads/' , '' ).replace ('refs/tags/' , 'tags/' )
192- except :
193- branch_name = 'master'
192+ except KeyError :
193+ try :
194+ # Bibucket server
195+ branch_name = event ['body-json' ]['push' ]['changes' ][0 ]['new' ]['name' ]
196+ except :
197+ branch_name = 'master'
194198 try :
195199 # GitLab
196200 remote_url = event ['body-json' ]['project' ]['git_ssh_url' ]
@@ -201,14 +205,14 @@ def lambda_handler(event, context):
201205 try :
202206 # GitHub
203207 remote_url = event ['body-json' ]['repository' ]['ssh_url' ]
204- except :
208+ except :
205209 # Bitbucket
206210 try :
207211 for i , url in enumerate (event ['body-json' ]['repository' ]['links' ]['clone' ]):
208212 if url ['name' ] == 'ssh' :
209213 ssh_index = i
210214 remote_url = event ['body-json' ]['repository' ]['links' ]['clone' ][ssh_index ]['href' ]
211- except :
215+ except :
212216 # BitBucket pull-request
213217 for i , url in enumerate (event ['body-json' ]['pullRequest' ]['fromRef' ]['repository' ]['links' ]['clone' ]):
214218 if url ['name' ] == 'ssh' :
@@ -234,4 +238,3 @@ def lambda_handler(event, context):
234238 os .remove ('/tmp/id_rsa' )
235239 os .remove ('/tmp/id_rsa.pub' )
236240 return 'Successfully updated %s' % repo_name
237-
You can’t perform that action at this time.
0 commit comments