You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过GitLab API根据合并请求查找对应的发布版本?

如何查找修复指定Bug(Issue ID)的软件版本号?

我需要找到修复指定Bug(对应Issue ID为42)的软件版本号,目前已完成以下操作:

  1. 调用接口获取标注修复该Issue的合并请求:
    GET projects/*cut*/issues/42/closed_by

返回的合并请求内容如下:

[
  {
    "id":"*cut*",
    "iid":31,
    "project_id":"*cut*",
    "title":"Demo merge request",
    "description":"Fixes #42",
    "state":"merged",
    "created_at":"2023-05-16T13:18:27.079Z",
    "updated_at":"2023-05-16T13:18:44.719Z",
    "merged_at":"2023-05-16T13:18:44.041Z",
    "closed_by":null,
    "closed_at":null,
    "target_branch":"master",
    "source_branch":"WorkFor42",
    "user_notes_count":0,
    "upvotes":0,
    "downvotes":0,
    "assignees":[],
    "assignee":null,
    "reviewers":[],
    "source_project_id":"*cut*",
    "target_project_id":"*cut*",
    "labels":[],
    "draft":false,
    "work_in_progress":false,
    "milestone":null,
    "merge_when_pipeline_succeeds":false,
    "merge_status":"can_be_merged",
    "detailed_merge_status":"not_open",
    "sha":"c8ddb6b51d500893f05ae40c646399d33408dad9",
    "merge_commit_sha":"1fa7f1a368af806fa8945d00fe99a08608e3d3ba",
    "squash_commit_sha":null,
    "discussion_locked":null,
    "should_remove_source_branch":true,
    "force_remove_source_branch":true,
    "reference":"!31",
    "references":{
      "short":"!31",
      "relative":"!31",
      "full":"*cut*/test!31"
    },
    "web_url":"https://*cut*/-/merge_requests/31",
    "time_stats":{
      "time_estimate":0,
      "total_time_spent":0,
      "human_time_estimate":null,
      "human_total_time_spent":null
    },
    "squash":false,
    "squash_on_merge":false,
    "task_completion_status":{
      "count":0,
      "completed_count":0
    },
    "has_conflicts":false,
    "blocking_discussions_resolved":true,
    "approvals_before_merge":null
  }
]

接下来我需要获取包含这个合并请求的发布标签名,但尝试的方法行不通:

  • 先调用GET projects/*cut*/releases列出所有发布
  • 再针对每个发布调用GET projects/*cut*/issues?state=closed&release_tag=each-name-from-prev-results,但这个API会忽略release_tag参数,无法得到对应结果。

内容的提问来源于stack exchange,提问作者Александр Кулагин

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 14:07:10