UpdatePushRule
Updates a specified push rule by overwriting the existing configuration. If you add a new rule item, ensure that the original rule items are also included. Otherwise, the original items are overwritten by the new content.
Operation description
Requires the permissions of a repository administrator or higher.
Try it now
Test
RAM authorization
Request syntax
PUT /api/v4/projects/{repositoryId}/push_rule/{pushRuleId} HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| repositoryId |
integer |
Yes |
The repository ID. |
2709413 |
| pushRuleId |
integer |
Yes |
The push rule ID. |
2077 |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| organizationId |
string |
Yes |
The organization ID in string format. You can obtain the ID from the Yunxiao URL, such as https://devops.aliyun.com/organization/[OrganizationId]. |
5ebbc0228123212b59xxxxx |
| accessToken |
string |
No |
The personal access token. This parameter is not required if you use an Alibaba Cloud AccessKey pair or Security Token Service (STS) for temporary authorization. |
f0b1e61db5961df5975a93f9129d2513 |
| body |
object |
No |
The request body. |
|
| ruleInfos |
array<object> |
No |
The list of rule information. |
|
|
object |
No |
The rule information. |
||
| checkerName |
string |
No |
The rule name. Valid values:
|
CommitAuthorChecker |
| extraMessage |
string |
No |
The extra message. This parameter is valid for commit message, commit email, author check, committer check, and force push prevention rules:
|
on |
| checkerType |
string |
No |
The restriction level for code owner checks. This parameter is valid only for the author check and committer check rules. You do not need to specify this parameter for other rules. Valid values:
|
warn |
| fileRuleRegexes |
array |
No |
The regular expressions for commit file restrictions. This parameter is valid only for the commit file restriction rule. You can specify multiple regular expressions. |
|
|
string |
No |
The regular expression for file restrictions. |
\.java$ |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| requestId |
string |
The request ID. |
ASSDS-ASSASX-XSAXSA-XSAXSAXS |
| errorCode |
string |
The error code. |
Openapi.RequestError |
| errorMessage |
string |
The error message. |
"" |
| success |
boolean |
Indicates whether the request is successful. |
true |
| result |
object |
The returned result. |
|
| id |
integer |
The push rule ID. |
30815 |
| ruleInfos |
array<object> |
The list of rule information. |
|
|
object |
The rule information. |
||
| checkerName |
string |
The rule name. Valid values:
|
CommitAuthorChecker |
| checkerType |
string |
The restriction level for code owner checks. This parameter is valid only for the author check and committer check rules. You do not need to specify this parameter for other rules. Valid values:
|
warn |
| extraMessage |
string |
The extra message. This parameter is valid for commit message, commit email, author check, committer check, and force push prevention rules:
|
on |
| fileRuleRegexes |
array |
The regular expressions for commit file restrictions. This parameter is valid only for the commit file restriction rule. You can specify multiple regular expressions. |
|
|
string |
The regular expression for file restrictions. |
\.java$ |
|
| gmtCreate |
string |
The creation time. |
2023-09-03T18:20:06+08:00 |
| gmtModified |
string |
The modification time. |
2023-09-03T18:20:06+08:00 |
Examples
Success response
JSON format
{
"requestId": "ASSDS-ASSASX-XSAXSA-XSAXSAXS",
"errorCode": "Openapi.RequestError",
"errorMessage": "\"\"",
"success": true,
"result": {
"id": 30815,
"ruleInfos": [
{
"checkerName": "CommitAuthorChecker",
"checkerType": "warn",
"extraMessage": "on",
"fileRuleRegexes": [
"\\.java$"
]
}
],
"gmtCreate": "2023-09-03T18:20:06+08:00",
"gmtModified": "2023-09-03T18:20:06+08:00"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.