CreateCommitStatus
Adds a commit status record to a specified commit.
Operation description
Uses the commit SHA and context as a combined condition to limit the number of commit status records in a single repository to 1,000. Otherwise, an error is returned.
Try it now
Test
RAM authorization
Request syntax
POST /api/v4/projects/repository/commit_statuses/create_commit_status HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| organizationId |
string |
Yes |
The enterprise identifier, also known as the enterprise ID. It is a string and can be obtained from the Yunxiao URL, such as https://devops.aliyun.com/organization/[OrganizationId]. |
5ebbc0228123212b59xxxxx |
| accessToken |
string |
No |
The personal access token. This field is not required if you use an Alibaba Cloud AccessKey ID and AccessKey secret or Security Token Service (STS) temporary authorization. |
f0b1e61db5961df5975a93f9129d2513 |
| repositoryIdentity |
string |
Yes |
The ID or full path of the code repository. |
2080972 |
| sha |
string |
Yes |
The commit ID, which is the commit SHA. |
e0c1a1299a2656bfc155650bbd2df5e628fa1f4c |
| body |
object |
No |
The request body. |
|
| state |
string |
Yes |
The status to be written. Only the following four strings are allowed. Otherwise, an error is returned. Valid values:
|
success |
| description |
string |
No |
The brief description of the commit status. It cannot exceed 3,000 characters. |
Commit status description |
| targetUrl |
string |
No |
The redirect URL written by the user. The code platform only provides the redirect UI. Generally, this can be set to a URL of a third-party system. |
https://example.com/builds/1001 |
| context |
string |
No |
The string identifier used to distinguish writes from different systems. It is displayed as a title in the corresponding page UI. The default value is default. The length cannot exceed 50 characters, and it is case-insensitive. Note
This parameter is crucial for configuring checkpoints and merge request integration. Do not modify it at will unless you are testing or debugging. |
default |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| requestId |
string |
The request ID. |
020F71F3-F063-5B8B-8978-2B01833216BB |
| success |
boolean |
Indicates whether the call was successful. |
true |
| errorCode |
string |
The error code. |
SYSTEM_UNKNOWN_ERROR |
| errorMessage |
string |
The error message. |
"" |
| result |
object |
The returned result. |
|
| id |
integer |
The ID. This ID has no actual business meaning. |
30815 |
| sha |
string |
The commit ID, which is the commit SHA. |
c0ca103441b9fa7f369be8d24a6f20db44dfddf7 |
| context |
string |
The string identifier used to distinguish writes from different systems. It is displayed as a title in the corresponding page UI. The default value is default. The length cannot exceed 50 characters, and it is case-insensitive. |
default |
| state |
string |
The written status. Valid values:
|
success |
| targetUrl |
string |
The redirect URL written by the user. The code platform only provides the redirect UI. Generally, this can be set to a URL of a third-party system. |
https://example.com/builds/1001 |
| description |
string |
The brief description of the commit status. It cannot exceed 3,000 characters. |
Commit status description |
| creator |
object |
The brief information about the user who wrote the commit status. |
|
| aliyunPk |
integer |
The Alibaba Cloud account ID. This field is empty if the type is Bot. |
204485087002425236 |
| login |
string |
The username if the type is User, or the application name if the type is Bot. |
codeup |
| avatarUrl |
string |
The URL of the avatar. |
https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100 |
| type |
string |
The type of the user who wrote the status. Valid values:
|
User |
Examples
Success response
JSON format
{
"requestId": "020F71F3-F063-5B8B-8978-2B01833216BB",
"success": true,
"errorCode": "SYSTEM_UNKNOWN_ERROR",
"errorMessage": "\"\"",
"result": {
"id": 30815,
"sha": "c0ca103441b9fa7f369be8d24a6f20db44dfddf7",
"context": "default",
"state": "success",
"targetUrl": "xxx",
"description": "Commit status description",
"creator": {
"aliyunPk": 204485087002425250,
"login": "codeup",
"avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
"type": "User"
}
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.