Repository submodules API

原文:https://docs.gitlab.com/ee/api/repository_submodules.html

Repository submodules API

在 GitLab 11.5 中引入

Update existing submodule reference in repository

在某些工作流程中,尤其是自动化的工作流程中,更新子模块的引用以使使用它的其他项目保持最新是很有用的. 该端点允许您在特定分支中更新Git 子模块引用.

  1. PUT /projects/:id/repository/submodules/:submodule
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
submodule string yes URL 编码的子模块完整路径. 例如, lib/class.rb
branch string yes 要提交的分支名称
commit_sha string yes 完全提交 SHA 以将子模块更新为
commit_message string no 提交消息. 如果未提供任何消息,则将设置默认消息
  1. curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/submodules/lib%2Fmodules%2Fexample"
  2. --data "branch=master&commit_sha=3ddec28ea23acc5caa5d8331a6ecb2a65fc03e88&commit_message=Update submodule reference"

响应示例:

  1. { "id": "ed899a2f4b50b4370feeea94676502b42383c746", "short_id": "ed899a2f4b5", "title": "Updated submodule example_submodule with oid 3ddec28ea23acc5caa5d8331a6ecb2a65fc03e88", "author_name": "Dmitriy Zaporozhets", "author_email": "dzaporozhets@sphereconsultinginc.com", "committer_name": "Dmitriy Zaporozhets", "committer_email": "dzaporozhets@sphereconsultinginc.com", "created_at": "2018-09-20T09:26:24.000-07:00", "message": "Updated submodule example_submodule with oid 3ddec28ea23acc5caa5d8331a6ecb2a65fc03e88", "parent_ids": [ "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" ], "committed_date": "2018-09-20T09:26:24.000-07:00", "authored_date": "2018-09-20T09:26:24.000-07:00", "status": null }