Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(api): add project templates#3057

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

gerry-pratama
Copy link
Contributor

@gerry-pratamagerry-pratama commentedDec 7, 2024
edited
Loading

Changes

Project template classes have been added toobjects/templates.py and their respective managers added to theProject class inobjects/projects.py to represent theproject templates API.

The project merge request template, in particular, will facilitate creating merge requests with adescription 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 matchingdocs section.
    • Documentation for the new classes has been added todocs/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/orfunctional tests
    • tests/unit/objects/test_templates.py has been added to test both instance and project templates.

@gerry-pratamagerry-pratama changed the titlefeat(api): add project templatesfeat(templates): add project templatesDec 7, 2024
@gerry-pratamagerry-pratamaforce-pushed theadd-project-templates branch 2 times, most recently from6d203b3 to2056b2cCompareDecember 7, 2024 07:29
@codecovCodecov
Copy link

codecovbot commentedDec 7, 2024
edited
Loading

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
FlagCoverage Δ
api_func_v482.63% <89.09%> (+0.07%)⬆️
cli_func_v482.65% <89.09%> (+0.05%)⬆️
unit88.99% <100.00%> (+0.16%)⬆️

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

Files with missing linesCoverage Δ
gitlab/v4/objects/projects.py98.84% <100.00%> (+0.02%)⬆️
gitlab/v4/objects/templates.py100.00% <100.00%> (ø)

Copy link
Member

@nejchnejch left a comment

Choose a reason for hiding this comment

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

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.

@nejchnejch changed the titlefeat(templates): add project templatesfeat(api): add project templatesDec 10, 2024
Copy link
Member

@nejchnejch left a comment

Choose a reason for hiding this comment

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

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. 🙇

gerry-pratama reacted with thumbs up emoji
@nejchnejch merged commit0d41da3 intopython-gitlab:mainDec 10, 2024
18 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nejchnejchnejch approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@gerry-pratama@nejch

[8]ページ先頭

©2009-2025 Movatter.jp