Extends
Your repo config file can "extend" an existing config file that lives somewhere else. This makes it easy re-use configurations across your organization and/or base your configuration off of a template.
Templates need to be publicly accessible via a HTTPS URL.
You can also use a private GitHub repo URL within the same organization (e.g. https://api.github.com/repos/your-org/pullapprove-config/contents/.pullapprove.yml
).
# you need at least these 2 fields to extend a template
version: 3
extends: https://api.github.com/repos/example/pullapprove-config/contents/.pullapprove.yml
Merging behavior
When you extend a template and provide settings in the .pullapprove.yml
file itself,
the settings will be merged together. You can see your merged config in the "Config" tab of the PullApprove status page.
The basic rule is that dictionaries will be merged, and any other kinds of fields will be overwritten.
Basic example
# Template YAML
version: 3
groups:
template_group: ...
# Repo YAML
version: 3
extends: <template url>
groups:
repo_group: ...
# Merged YAML
version: 3
extends: <template url>
groups:
template_group: ...
repo_group: ...
Fields that override
Fields that are lists, integers, or strings will be overwritten by your repo config.
A common example of this is pullapprove_conditions
.
# Template YAML
version: 3
pullapprove_conditions:
- <template condition>
# Repo YAML
version: 3
extends: <template url>
pullapprove_conditions:
- <repo condition>
# Merged YAML
version: 3
extends: <template url>
pullapprove_conditions:
- <repo condition>