Skip to content

Commit 27c9516

Browse files
Adds supports for branches called "feature/this_and_that" which are perfectly fine and used by gitflow approach.
The original split is doing: ref/master/feature/this_and_that -> causing that "feature" is selected as branch name, rather than "feature/this_and_that" Note: Adapted from pull request #8 by cypreess.
1 parent a037231 commit 27c9516

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

webhooks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def index():
100100
# Gather data
101101
try:
102102
payload = request.get_json()
103-
except:
103+
except Exception:
104+
logging.warning('Request parsing failed')
104105
abort(400)
105106

106107
# Determining the branch is tricky, as it only appears for certain event
@@ -122,7 +123,7 @@ def index():
122123

123124
elif event in ['push']:
124125
# Push events provide a full Git ref in 'ref' and not a 'ref_type'.
125-
branch = payload['ref'].split('/')[2]
126+
branch = payload['ref'].split('/', 2)[2]
126127

127128
except KeyError:
128129
# If the payload structure isn't what we expect, we'll live without

0 commit comments

Comments
 (0)