-
Notifications
You must be signed in to change notification settings - Fork 671
feat(api): add listing user contributed projects #3179
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
feat(api): add listing user contributed projects #3179
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3179 +/- ##
==========================================
+ Coverage 94.07% 97.32% +3.24%
==========================================
Files 98 98
Lines 6038 6046 +8
==========================================
+ Hits 5680 5884 +204
+ Misses 358 162 -196
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Question: If I am user 'bob' can I list the contributed projects of user 'alice'? |
Yes, it looks to be the case. I just ran a couple of tests with two users on my local GitLab. Test 1The first user
Initially, the second user's API-key sees no "contributed projects" of gitlab -g testuser101 user-contributed-project list --user-id gituser0 After the first user created MR (has not merged yet), the first user's contributed projects list the one with the MR:
After the merge, the contribution stays visible. Test 2After
ConclusionBased on these tests, it seems this endpoint shows user "bob" public contributions of user "alice" in namespaces other than "alice/*". Edit: clarity + add the second test case |
eb382e6
to
f486bc7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Implements a new endpoint to list projects a user has contributed to via the GitLab API.
- Adds
UserContributedProject
and its manager to the Python client - Updates
User
object to exposecontributed_projects
- Provides fixture and unit test in
test_users.py
and updates documentation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
gitlab/v4/objects/users.py | Define UserContributedProject and UserContributedProjectManager , add to User |
tests/unit/objects/test_users.py | Add HTTP fixture and test_list_contributed_projects |
docs/gl_objects/users.rst | Document user.contributed_projects.list() usage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @darkhaniop
Changes
This PR implements an endpoint for listing a user's contributed projects (related issue #3119):
GitLab docs: https://docs.gitlab.com/api/projects/#list-projects-a-user-has-contributed-to
API usage
CLI usage
Modified files:
Documentation and testing
Please consider whether this PR needs documentation and tests. This is not required, but highly appreciated: