Viewing Repository Commit Rules
Function
This API is used to view repository commit rules.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
|
Action |
Access Level |
Resource Type (*: required) |
Condition Key |
Alias |
Dependencies |
|---|---|---|---|---|---|
|
codeartsrepo:repository:getRepository |
Read |
- |
- |
- |
- |
URI
GET https://{hostURL}/v4/repositories/{repository_id}/commit-rules
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
repository_id |
Yes |
Integer |
Definition You can query the project list to obtain the repository ID by calling the API used to query user's all repositories. Constraints N/A Default Value N/A Value range: 1~2147483647 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
offset |
No |
Integer |
Definition Offset, which starts from 0. Value range: 0~2147483647 Default value: 0 |
|
limit |
No |
Integer |
Definition Number of returned records. Value range: 1~100 Default value: 20 |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token. Obtain one by calling the IAM API Obtaining a User Token. The value of X-Subject-Token in the response header is a token. Constraints N/A Range 1–100,000 characters. Default Value N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
X-Total |
String |
Total number of results of the current request. |
|
Parameter |
Type |
Description |
|---|---|---|
|
[items] |
Array of CommitRuleDto objects |
Repository commit rule list. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition: Primary key ID. Value range: N/A. Value range: 1~2147483647 |
|
repository_id |
Integer |
Definition: Repository ID. Value range: N/A. Value range: 1~2147483647 |
|
commit_message_regex |
String |
Definition: Commit message match. |
|
commit_message_negative_regex |
String |
Definition: Commit message negative match. |
|
prohibited_file_name_regex |
String |
Definition: File name that cannot be submitted. |
|
author_email_regex |
String |
Definition: Committer's email address. |
|
max_file_size |
Integer |
Definition: Maximum size of a single file, in MB. Value range: 0~300 |
|
allowed_max_file_size |
Integer |
Definition: Maximum size of a single file, in MB. Value range: 0~300 |
|
effective_date |
String |
Definition: Rule effective time. |
|
binary_gate_enabled |
Boolean |
Definition: Whether to forbid new binary files (invalid for privileged users). Constraints: N/A. Value range:
|
|
privileged_users |
Array of RepositoryUserBasicDto objects |
Definition: Privileged user (who can directly push all binary files to the database). |
|
allowed_modify_binary |
Boolean |
Definition: Whether to allow changes to binary files (privileged users excepted). Constraints: N/A. Value range:
|
|
allowed_binary_file_name_regex |
String |
Definition: Binary file whitelist (that can be imported to the database). |
|
author_regex |
AnyType |
Definition: Committer. |
|
updated_at |
String |
Definition: Update time. |
|
name |
String |
Definition: Rule name. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
branch_name |
String |
Definition: Branch rule. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
created_at |
String |
Definition: Creation time. Constraints: N/A. Value range: N/A. Default value: N/A. |
|
skip_rule_check |
Boolean |
Definition: Rule detection is skipped. Constraints: This parameter is available only for the CR repository. |
|
skip_rule_end_date |
String |
Definition: Expiration time of rule skipping, for example, 2025-8-19. Constraints: This parameter is available only for the CR repository. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
Integer |
Definition: User ID. Constraints: N/A. Value range: 1~2147483647 |
|
name |
String |
Definition: Username. Constraints: N/A. |
|
username |
String |
Definition: Username. Constraints: N/A. |
|
state |
String |
Definition: User status Value range:
Enumeration values:
|
|
service_license_status |
Integer |
Definition: Service-level permission status. 0: Disabled; 1: Enabled. Constraints: N/A. Value range: 1~2147483647 |
|
name_cn |
String |
Definition: Username in Chinese. Constraints: N/A. |
|
nick_name |
String |
Definition: User alias. Constraints: N/A. |
|
tenant_name |
String |
Definition: Tenant name. Constraints: N/A. |
Example Requests
None
Example Responses
Status code: 200
Repository commit rule list.
[ {
"id" : 169352,
"repository_id" : 2112035798,
"commit_message_regex" : "test",
"commit_message_negative_regex" : "test",
"prohibited_file_name_regex" : "test",
"author_email_regex" : "test",
"max_file_size" : 50,
"allowed_max_file_size" : 300,
"effective_date" : "2025-01-14T20:13:56.000+08:00",
"binary_gate_enabled" : true,
"privileged_users" : [ {
"id" : 9124,
"name" : "test_user",
"username" : "test_user",
"state" : "active",
"service_license_status" : null,
"name_cn" : "test_user",
"nick_name" : "beta_dv",
"tenant_name" : "test_tenant"
} ],
"allowed_modify_binary" : true,
"allowed_binary_file_name_regex" : "test",
"author_regex" : "test",
"name" : "2",
"branch_name" : "2",
"created_at" : "2025-06-20T17:37:55.000+08:00",
"updated_at" : "2025-06-20T17:37:55.000+08:00"
} ]
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Repository commit rule list. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot