CreatePushRule
Create a push rule.
Operation description
You must have repository administrator permissions or higher.
Try it now
Test
RAM authorization
Request syntax
POST /api/v4/projects/{repositoryId}/push_rule HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| repositoryId |
integer |
Yes |
The repository ID. |
187687 |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| organizationId |
string |
Yes |
The organization ID. You can get this ID from your Alibaba Cloud DevOps URL, for example: |
5ebbc0228123212b59xxxxx |
| accessToken |
string |
No |
The personal access token. This parameter is not required if you authenticate by using an Alibaba Cloud AccessKey pair or STS temporary authorization. |
f0b1e61db5961df5975a93f9129d2513 |
| body |
object |
No |
The request body. |
|
| ruleInfos |
array<object> |
Yes |
A list of rule objects. |
|
|
object |
No |
A rule object. |
||
| checkerName |
string |
No |
The name of the rule. Valid values:
|
CommitMessageChecker |
| extraMessage |
string |
No |
The behavior of this parameter varies based on the value of
|
user@example.com |
| checkerType |
string |
No |
Specifies the enforcement level for a code ownership check. This parameter is valid only for
|
warn |
| fileRuleRegexes |
array |
No |
An array of regular expressions to restrict file paths. This parameter is used only when |
|
|
string |
No |
A regular expression to restrict file paths. |
\.java$ |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response schema. |
||
| requestId |
string |
The request ID. |
ASSDS-ASSASX-XSAXSA-XSAXSAXS |
| errorCode |
string |
The error code. |
"" |
| errorMessage |
string |
The error message. |
"" |
| success |
boolean |
Indicates whether the request was successful. |
true |
| result |
object |
The result. |
|
| id |
integer |
The push rule ID. |
2077 |
| ruleInfos |
array<object> |
The list of rules. |
|
|
object |
Information about a single rule. |
||
| checkerName |
string |
The rule name. Valid values:
|
ForcePushChecker |
| checkerType |
string |
The enforcement level. This parameter applies only to the commit author check and committer check rules. Valid values:
|
warn |
| extraMessage |
string |
Additional information about the rule. The value of this parameter depends on the value of
|
disabled |
| fileRuleRegexes |
array |
An array of regular expressions for the commit file limit rule. Multiple expressions are supported. |
|
|
string |
A regular expression used for restricting files. |
\.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": "\"\"",
"errorMessage": "\"\"",
"success": true,
"result": {
"id": 2077,
"ruleInfos": [
{
"checkerName": "ForcePushChecker",
"checkerType": "warn",
"extraMessage": "disabled",
"fileRuleRegexes": [
"\\.java$\n"
]
}
],
"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.