Skip to content

Commit c9614fa

Browse files
author
Alex Crowe
committed
Merge pull request #5 from BlueBayTravel/gitlab-labels
First attempt at adding labels to issues via Sentry to GitLab
2 parents c175e41 + 22f0219 commit c9614fa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/sentry_gitlab/plugin.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ class GitLabOptionsForm(forms.Form):
3434
help_text=_('Enter your repository name, including namespace.'),
3535
required=True)
3636

37+
gitlab_labels = forms.CharField(
38+
label=_('Issue Labels'),
39+
widget=forms.TextInput(attrs={'placeholder': 'e.g. high, bug'}),
40+
help_text=_('Enter the labels you want to auto assign to new issues.'),
41+
required=False)
42+
3743

3844
class GitLabPlugin(IssuePlugin):
3945
author = 'Pancentric Ltd'
@@ -62,6 +68,7 @@ def create_issue(self, request, group, form_data, **kwargs):
6268
url = self.get_option('gitlab_url', group.project)
6369
token = self.get_option('gitlab_token', group.project)
6470
repo = self.get_option('gitlab_repo', group.project)
71+
labels = self.get_option('gitlab_labels', group.project)
6572
if repo.find('/') == -1:
6673
repo_url = str(repo)
6774
else:
@@ -76,7 +83,7 @@ def create_issue(self, request, group, form_data, **kwargs):
7683
except Exception as e:
7784
raise forms.ValidationError(_('Error Communicating with GitLab: %s') % (e,))
7885

79-
data = {'title': form_data['title'], 'description': form_data['description']}
86+
data = {'title': form_data['title'], 'description': form_data['description'], 'labels': labels}
8087

8188
proj = gl.Project(id=repo_url)
8289
issue = proj.Issue(data)

0 commit comments

Comments
 (0)