Skip to content

feat(api): add project templates #1

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

gerry-pratama
Copy link
Owner

@gerry-pratama gerry-pratama commented Dec 5, 2024

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.mergerequest_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 gerry-pratama self-assigned this Dec 5, 2024
@gerry-pratama gerry-pratama force-pushed the add-project-templates branch 3 times, most recently from b023fff to 284550b Compare December 7, 2024 05:19
@gerry-pratama gerry-pratama marked this pull request as ready for review December 7, 2024 05:33
@gerry-pratama gerry-pratama force-pushed the add-project-templates branch 3 times, most recently from 6d203b3 to 2056b2c Compare December 7, 2024 07:29
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.

1 participant