1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

gitlab_issue: use search instead of title (#7847)

* gitlab_issue: use search instead of title

* Create changelog file

* Update changelogs/fragments/7847-gitlab-issue-title.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* using query_parameters

Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>

* sanity checks

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Nejc Habjan <hab.nejc@gmail.com>
This commit is contained in:
Gabriele Pongelli 2024-02-17 12:30:54 +01:00 committed by GitHub
parent 6088e2dc0f
commit 8ea58618db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- gitlab_issue - fix behavior to search GitLab issue, using ``search`` keyword instead of ``title`` (https://github.com/ansible-collections/community.general/issues/7846).

View file

@ -183,7 +183,7 @@ class GitlabIssue(object):
def get_issue(self, title, state_filter): def get_issue(self, title, state_filter):
issues = [] issues = []
try: try:
issues = self.project.issues.list(title=title, state=state_filter) issues = self.project.issues.list(query_parameters={"search": title, "in": "title", "state": state_filter})
except gitlab.exceptions.GitlabGetError as e: except gitlab.exceptions.GitlabGetError as e:
self._module.fail_json(msg="Failed to list the Issues: %s" % to_native(e)) self._module.fail_json(msg="Failed to list the Issues: %s" % to_native(e))