ive looking for method which i can use for getting all comments texts from commits added with last build pipeline in gitlab
we can take commits sha key by using gitlab api, but this request dont getting any information about commit comments (sha key holding changed commits id):
curl --header "PRIVATE-TOKEN: ********" "https://gitlab.example.com/api/v4/projects/1/pipelines/latest"
{"id":442495,"sha":"e6b81550c9251b88a273ba6c86938769a76f9d15","ref":"master","status":"success","created_at":"2021-01-21T09:15:09.290+03:00","updated_at":"2021-01-21T09:15:27.869+03:00","web_url":"https://gitlab.example.com/ci/testproject/-/pipelines/442495","before_sha":"0000000000000000000000000000000000000000","tag":false,"yaml_errors":null,"user":{"id":369,"name":"John, Doe","username":"jdoe","state":"active","avatar_url":"****","web_url":"****","finished_at":"2021-01-21T09:15:27.857+03:00","committed_at":null,"duration":6,"coverage":null,"detailed_status":{"icon":"status_success","text":"passed","label":"passed","group":"success","tooltip":"passed","has_details":false,"details_path":"/ci/testproject/-/pipelines/123456","illustration":null,"favicon":"/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png"}}
at completed result we should get all text included in commits comments
Gitlab has a Commits API that you can use to get all commits in a project, or retrieve a single commit from it's sha. For your use case, after you get the commits for the pipeline, you can run each one through the "get single commit" API to get the title/message (or any other part) as needed. You can also run the commit sha through the Commits Comments operation to get comments on that commit.
The details for the Commits API and the Get Single Commit operation are here:https://docs.gitlab.com/ee/api/commits.html#get-a-single-commit
The Commit Comments operation is here: https://docs.gitlab.com/ee/api/commits.html#get-the-comments-of-a-commit
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.