From ec2d758371b9ac0bce63c66f9c7113b7bc7b73f7 Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Wed, 23 Sep 2026 12:10:04 +0200 Subject: [PATCH] Fix commit-message label parsing on issue webhooks Three bugs in the "parse commit message, manage labels" feature caused it to crash on every use: parse_commit_labels() was called without its required labels argument, simplify_labels() was called with the raw issue label_ops list instead of the full parse result and without board_labels (defaulting to None), and ops[1] was a str being passed to .decode('utf-8'), which str has no method for in Python 3. Co-Authored-By: Claude Sonnet 5 --- gwh/__init__.py | 7 ++++--- gwh/helpers.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gwh/__init__.py b/gwh/__init__.py index c6730a8..81ccd6e 100644 --- a/gwh/__init__.py +++ b/gwh/__init__.py @@ -121,10 +121,11 @@ def index(): labels = helpers.get_label_names(gl.get_labels(project_id)) list_labels = helpers.get_list_labels(gl.get_boards(project_id)) for commit in payload['commits']: - parse_commit = helpers.parse_commit_labels(commit['message']) + parse_commit = helpers.parse_commit_labels(commit['message'], labels) for issue in parse_commit['issues']: - issue_labels = gl.get_issue(project_id, issue) - updated_labels = helpers.simplify_labels(issue_labels, parse_commit['label_ops']) + issue_json = gl.get_issue(project_id, issue) + existing_labels = helpers.get_issue_labels(issue_json) + updated_labels = helpers.simplify_labels(existing_labels, parse_commit, list_labels) gl.set_issue_labels(project_id, issue, updated_labels) return 'OK' diff --git a/gwh/helpers.py b/gwh/helpers.py index 63b2d2c..5b0e40c 100644 --- a/gwh/helpers.py +++ b/gwh/helpers.py @@ -32,7 +32,7 @@ def simplify_labels(self, existing, from_message, board_labels = None): labels = existing for ops in from_message['label_ops']: op = ops[0] - name = ops[1].decode('utf-8') + name = ops[1] if op == '+': labels.append(name) if op == '-':