Define branch configuration for a repository
Learn how to use the Repository Settings API to define branch configuration for a repository.
All sample requests in this guide include the following path parameters:
Parameter name | Description |
---|---|
tenantId | Your tenant ID. |
starSystemId | ID of a star system that includes the repository for which you modify the branch configuration. |
repositoryName | Name of a repository. See supported repositories. |
About branch configuration
To customize branch configuration for a repository, you can do the following:
- Enable or disable selected branch types.
- Specify a prefix for each branch type.
For example, you can use the dedicated branches for development in parallel to your main codebase and without affecting it.
You can't use the Repository Settings API to change the branching strategy defined by Guidewire Cloud Standards.
Default configuration
Branch configuration is defined on the project (star system) level and, by default, inherited by each repository. You can customize this configuration separately for each repository in your star system.
You can't modify a project (star system) level configuration with the Repository Settings API.
Get configuration
To retrieve branch configuration for a repository, send the following GET
request:
curl -X 'GET' \
'{baseUrl}/api/v1/tenants/{tenantId}/starsystems/{starSystemId}/repository/{repositoryName}/branch-configuration' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {access_token}'
Response contains a JSON object with current branch configuration for the specified repository.
{
"development": {
"refId": null,
"useDefault": true
},
"production": {
"refId": "refs/heads/master",
"useDefault": false
},
"prefixes": {
"bugfix": {
"enabled": true,
"prefix": "bugfix/"
},
"feature": {
"enabled": false,
"prefix": "feature/"
},
"hotfix": {
"enabled": true,
"prefix": "hotfix/"
},
"release": {
"enabled": false,
"prefix": "release/"
}
},
"scope": {
"type": "REPOSITORY"
}
}
Modify branch configuration
To modify branch configuration for a repository, send the following PUT
request:
curl -X 'PUT' \
'{baseUrl}/api/v1/tenants/{tenantId}/starsystems/{starSystemId}/repository/{repositoryName}/branch-configuration' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-d '{body}'
Where {body}
contains the updated configuration.
For example, to use custom development and production branches and specify the bugfix and hotfix prefixes, use the following:
{
"development": {
"refId": "refs/heads/master",
"useDefault": false
},
"production": {
"refId": "refs/heads/master",
"useDefault": false
},
"prefixes": {
"bugfix": {
"prefix": "bugfix/",
"enabled": true
},
"feature": {
"prefix": "feature/",
"enabled": false
},
"hotfix": {
"prefix": "hotfix/",
"enabled": true
},
"release": {
"prefix": "release/",
"enabled": false
}
}
}
For a successful request, you will receive the 200
status code and the updated branch configuration.
{
"development": {
"refId": "refs/heads/master",
"useDefault": false
},
"production": {
"refId": "refs/heads/master",
"useDefault": false
},
"prefixes": {
"bugfix": {
"enabled": true,
"prefix": "bugfix/"
},
"feature": {
"enabled": false,
"prefix": "feature/"
},
"hotfix": {
"enabled": true,
"prefix": "hotfix/"
},
"release": {
"enabled": false,
"prefix": "release/"
}
},
"scope": {
"type": "REPOSITORY"
}
}
Restore default configuration
You can also restore the default branch configuration for your repository. To do that, send the following DELETE
request:
curl -X 'DELETE' \
'{baseUrl}/api/v1/tenants/{tenantId}/starsystems/{starSystemId}/repository/{repositoryName}/branch-configuration' \
-H 'Accept: */*' \
-H 'Authorization: Bearer {access_token}'
For a successful request, you will receive the 204
status code.
Was this page helpful?