Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launchpad: API search for PRs on GitLab #3788

Open
sergeibbb opened this issue Nov 21, 2024 · 2 comments · May be fixed by #3795
Open

Launchpad: API search for PRs on GitLab #3788

sergeibbb opened this issue Nov 21, 2024 · 2 comments · May be fixed by #3795
Assignees
Labels
feature New feature or request
Milestone

Comments

@sergeibbb
Copy link
Member

sergeibbb commented Nov 21, 2024

This issue is a follow-up of #3543


Todo

  • ✅ Search for PRs on GitLab
  • ✅ Perform the PR search for all connected providers
  • ✅ Group found repo+prID pairs by provider to perform the more precise search
  • ✅ Search GitLab PR by PR URL
  • ✅ Get head-ref id on each PR, to be able to show checkout-like actions

Follow-ups

  • ⏺️ Search by number on current repositories

Testing notes

Connect both GitLab and GitHub. Search by:

  • GitHub URL of a local PR (a PR from your repositories)
  • GitLab URL of a local PR
  • GitHub URL in internet (a random PR on internet)
  • GitLab URL in internet
  • text query

Pay attention to user avatars. GitLab's graph-ql returns them differently in different requests: sometimes it's an URL, but sometimes it's just a path.

Disconnect GitHub. Search by a text query.

@sergeibbb sergeibbb self-assigned this Nov 21, 2024
@sergeibbb sergeibbb added this to the Shortlist milestone Nov 21, 2024
@sergeibbb sergeibbb added the feature New feature or request label Nov 21, 2024
@sergeibbb
Copy link
Member Author

sergeibbb commented Nov 22, 2024

Hi @axosoft-ramint , @eamodio

I have a following question. It looks like GitLab's GraphQL is not able to search for PRs in general. It can does the following:

  • get for a user: one of the following
    • assignedMergeRequests
    • authoredMergeRequests
    • reviewRequestedMergeRequests
  • get for a project/group

Now for the Launchpad "get for a user" set of requests is used but retrieving only open ones: state:opened

Also there is a REST API endpoint that just searches everywhere, e.g.: https://gitlab.com/api/v4/search?scope=merge_requests&search=flight

What I can do:

  1. use "get by user" requests withtout state:opened limitations. By doing that I loose PRs that are not associated with the current user.
  2. use "get by project" request for currently opened repositories. By doing that I loose PRs that belong to other projects.
  3. use REST API endpoint. The results can be too wide, but now we have same for GitHub.

For now I'm going to continue with # 3 until we choose another option or find a better solution.

Also, maybe I just wrong about GraphQL possibilities and it can search, and I just haven't found how to do that.

What do you think?

@axosoft-ramint
Copy link
Contributor

I feel like since what we're doing with GitHub on a search is "search everywhere", we should have equivalent behavior for GitLab. So 3 sounds right.

@sergeibbb sergeibbb linked a pull request Nov 25, 2024 that will close this issue
7 tasks
@sergeibbb sergeibbb linked a pull request Nov 25, 2024 that will close this issue
7 tasks
sergeibbb added a commit that referenced this issue Dec 23, 2024
sergeibbb added a commit that referenced this issue Dec 26, 2024
sergeibbb added a commit that referenced this issue Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants