Repository: ansible-collections/community.general

Issue:
gitlab_issue: title attribute not used when listing
### Summary

Using gitlab_issue module, `title` string is required but it's not used by underlying library python_gitlab's list method.

More specifically, [this call into gitlab_issue module](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/gitlab_issue.py#L186) passes a keyword "title" to python-gitlab library, that [does not use it for "list" method](https://github.com/python-gitlab/python-gitlab/blob/72e1aa7f2c2aad739db2f5dd4394165a5b5f2432/gitlab/v4/objects/issues.py#L54).

What happens is that many issues are returned, filtering only through the state (that's an admitted filter), ignoring the title.

### Issue Type

Bug Report

### Component Name

gitlab_issue

### Ansible Version

```console (paste below)
$ ansible --version
ansible [core 2.16.2]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/.cache/pypoetry/virtualenvs/gitlab-user-checks-bxct1Kz8-py3.11/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/.cache/pypoetry/virtualenvs/gitlab-user-checks-bxct1Kz8-py3.11/bin/ansible
  python version = 3.11.7 (main, Dec  8 2023, 14:22:46) [GCC 13.2.0] (/root/.cache/pypoetry/virtualenvs/gitlab-user-checks-bxct1Kz8-py3.11/bin/python)
  jinja version = 3.1.3
  libyaml = True
```


### Community.general Version

```console (paste below)
$ ansible-galaxy collection list community.general


# /root/.cache/pypoetry/virtualenvs/gitlab-user-checks-bxct1Kz8-py3.11/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 8.1.0
```


### Configuration

```console (paste below)
$ ansible-config dump --only-changed

```


### OS / Environment

debian trixie

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
  - name: Change assignee
    community.general.gitlab_issue:
      api_url: "{{ api_url }}"
      api_token: "{{ access_token }}"
      project: "existing-project"
      title: "title copied from gitlab issue page"
      assignee_ids:
        - assignee
      state: present
```


### Expected Results

`title` parameter used to filter gitlab's issue, or another way to obtain only one issue to be then changed.

task above should be executed changing the issue's assignee, searched through title, with specified one.

### Actual Results

```console (paste below)
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Multiple Issues matched search criteria."}
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


### Solution
"search" is the keyword to be used, instead of "title".


Discussion:
Files identified in the description:
* [`plugins/modules/gitlab_issue.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/gitlab_issue.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Lunik @Shaps @lgatellier @marwatk @metanovii @nejch @scodeman @sh0shin @suukit @waheedi @zanssa @zvaraondrej
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->
python-gitlab passes any kind of list filters to the API, the code you linked is used internally for the CLI rather than the python client. I'll double check but I doubt this is the case.
I forgot to mention that the case I’ve error is when doing an issue update.

Furthermore, those are the [gitlab api](https://docs.gitlab.com/ee/api/issues.html#) and there’s no mention about `title` as attribute while listing, but `search` is there.
Is it possible that it was `title` for an older version of GitLab, and eventually changed to the more generic `search`?
> Is it possible that it was `title` for an older version of GitLab, and eventually changed to the more generic `search`?

I’m not aware of this change

Resolving patch:
diff --git a/plugins/modules/gitlab_issue.py b/plugins/modules/gitlab_issue.py
--- a/plugins/modules/gitlab_issue.py
+++ b/plugins/modules/gitlab_issue.py
@@ -183,7 +183,7 @@ def get_milestone(self, milestone_id, group):
     def get_issue(self, title, state_filter):
         issues = []
         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:
             self._module.fail_json(msg="Failed to list the Issues: %s" % to_native(e))
 


Test patch: