FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(api): add project templates by gerry-pratama · Pull Request #3057 · python-gitlab/python-gitlab · GitHub

Repository navigation

feat(api): add project templates - #3057

Merged
nejch merged 5 commits into
python-gitlab:mainfrom
gerry-pratama:add-project-templates
Dec 10, 2024
Merged

nejch merged 5 commits into
python-gitlab:mainfrom
gerry-pratama:add-project-templates

Conversation

gerry-pratama commented Dec 7, 2024 •
edited
Loading

Copy link
Copy Markdown
Contributor

Changes

Project template classes have been added to objects/templates.py and their respective managers added to the Project class in objects/projects.py to represent the project templates API.

The project merge request template, in particular, will facilitate creating merge requests with a description template, like the following example:

mr_description_template = project.merge_request_templates.get("Default")
mr = project.mergerequests.create({'source_branch': 'cool_feature',
                                   'target_branch': 'main',
                                   'title': 'merge cool feature',
                                   'description': mr_description_template.content})

Documentation and testing

Please consider whether this PR needs documentation and tests. This is not required, but highly appreciated:

  • Documentation in the matching docs section.
    • Documentation for the new classes has been added to docs/gl_objects/templates.rst.
    • docs/gl_objects/merge_requests.rst has been updated to include an example of creating an MR with a default description template.
  • Unit tests and/or functional tests
    • tests/unit/objects/test_templates.py has been added to test both instance and project templates.

gerry-pratama changed the title feat(api): add project templates feat(templates): add project templates Dec 7, 2024
gerry-pratama force-pushed the add-project-templates branch 2 times, most recently from 6d203b3 to 2056b2c Compare December 7, 2024 07:29

codecov Bot commented Dec 7, 2024 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.67%. Comparing base (735efff) to head (24af304).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3057      +/-   ##
==========================================
+ Coverage   96.64%   96.67%   +0.02%     
==========================================
  Files          95       95              
  Lines        6142     6197      +55     
==========================================
+ Hits         5936     5991      +55     
  Misses        206      206              
Flag Coverage Δ
api_func_v4 82.63% <89.09%> (+0.07%) ⬆️
cli_func_v4 82.65% <89.09%> (+0.05%) ⬆️
unit 88.99% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
gitlab/v4/objects/projects.py 98.84% <100.00%> (+0.02%) ⬆️
gitlab/v4/objects/templates.py 100.00% <100.00%> (ø)

nejch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks a lot for this @gerry-pratama, looks great! Just a nit on the naming and the tests, but I'm ok with this as well otherwise. These endpoints are definitely a bit funny on the GitLab side so makes sense to parametrize a bit.

Comment thread gitlab/v4/objects/projects.py Outdated
Comment thread tests/unit/objects/test_templates.py Outdated
gerry-pratama requested a review from nejch December 10, 2024 02:24
nejch changed the title feat(templates): add project templates feat(api): add project templates Dec 10, 2024

nejch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks again @gerry-pratama, looks great! I might squash this one as we use it for the changelog and users are mostly interested in the public API in the release notes. 🙇

nejch merged commit 0d41da3 into python-gitlab:main Dec 10, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL