
---

## Releases（发行版本）相关接口

- **获取最新发布版本（Latest Release）**  
    `GET /repos/{owner}/{repo}/releases/latest`  
    返回最新非预发布、非草稿版的发布详情，包括版本号、发布时间、说明等。([GitHub Docs](https://docs.github.com/en/rest/releases?utm_source=chatgpt.com "REST API endpoints for releases and release assets"))
    
- **列出所有发布版本（List Releases）**  
    `GET /repos/{owner}/{repo}/releases`  
    返回该仓库所有发布版本的列表，不包含未关联发布的普通 Git 标签。([GitHub Docs](https://docs.github.com/en/rest/releases/releases?utm_source=chatgpt.com "REST API endpoints for releases"))
    
- **通过 Tag 获取指定发布版本（Get a Release by Tag）**  
    `GET /repos/{owner}/{repo}/releases/tags/{tag}`  
    根据具体 tag 名称获取对应发布版本的信息。([GitHub Docs](https://docs.github.com/en/rest/releases?utm_source=chatgpt.com "REST API endpoints for releases and release assets"))
    
- **创建、更新、删除发布版本（Create / Update / Delete Release）**
    
    - `POST /repos/{owner}/{repo}/releases` — 创建新的发布版本
        
    - `PATCH /repos/{owner}/{repo}/releases/{release_id}` — 更新发布版本
        
    - `DELETE /repos/{owner}/{repo}/releases/{release_id}` — 删除发布版本  
        （这些操作通常需要认证权限。）([GitHub Docs](https://docs.github.com/en/rest/releases?utm_source=chatgpt.com "REST API endpoints for releases and release assets"))
        

---

## Git Tags（标签）相关接口

- **列出仓库的 Git 标签**  
    `GET /repos/{owner}/{repo}/tags`  
    返回该仓库所有标签（包括 lightweight 和 annotated）。([Stack Overflow](https://stackoverflow.com/questions/18384873/how-to-list-the-releases-of-a-repository?utm_source=chatgpt.com "github - How to list the releases of a repository?"), [GitHub Docs](https://docs.github.com/en/rest/repos/tags?utm_source=chatgpt.com "REST API endpoints for repository tags"))
    
- **获取标签引用（Tag Reference）**  
    `GET /repos/{owner}/{repo}/git/refs/tags/{tag_name}`  
    可获取该标签所对应的对象（TAG_SHA），用于进一步查询。([Stack Overflow](https://stackoverflow.com/questions/72429056/how-to-get-single-tag-information-using-github-api?utm_source=chatgpt.com "How to get Single tag Information using GitHub Api?"))
    
- **获取 Annotated Tag 对象详情**  
    `GET /repos/{owner}/{repo}/git/tags/{tag_sha}`  
    获取标签对象的完整信息，包括 `object.sha` 即对应的 commit SHA、tagger、message 等。([Stack Overflow](https://stackoverflow.com/questions/72429056/how-to-get-single-tag-information-using-github-api?utm_source=chatgpt.com "How to get Single tag Information using GitHub Api?"))
    

---

## Commits（提交）相关接口

- **列出提交记录（List Commits）**  
    `GET /repos/{owner}/{repo}/commits`  
    返回最新的提交列表，第一个通常为最新提交。响应中包含 SHA、作者、提交信息、签名验证信息等。([GitHub Docs](https://docs.github.com/en/rest/commits/commits?utm_source=chatgpt.com "REST API endpoints for commits"))
    
- **获取单个提交详情（Get a Commit）**  
    `GET /repos/{owner}/{repo}/commits/{commit_sha}`  
    获取指定提交的详细信息。([GitHub Docs](https://docs.github.com/en/rest/commits?utm_source=chatgpt.com "REST API endpoints for commits"))
    
- **比较两个提交（Compare Commits）**  
    `GET /repos/{owner}/{repo}/compare/{base}...{head}`  
    用于比较两个 commit 或两个 tag 之间的差异。([Stack Overflow](https://stackoverflow.com/questions/61359461/get-all-commits-in-a-git-tag-through-github-api-return-only-the-first-commit?utm_source=chatgpt.com "get all commits in a Git tag through GitHub API return only ..."))
    

---

## 综合流程示例

下面是一个常见逻辑，例如想获取最新发布对应的 commit SHA：

1. 调用 `GET /repos/{owner}/{repo}/releases/latest` 获取最新 release 的 `tag_name`。
    
2. 调用 `GET /repos/{owner}/{repo}/git/refs/tags/{tag_name}` 获取 TAG_SHA。
    
3. 调用 `GET /repos/{owner}/{repo}/git/tags/{tag_sha}` 获取该标签对象的 commit SHA（object.sha）。
    

这套流程常用于从发布版本跳转到对应的 Git 提交。([Stack Overflow](https://stackoverflow.com/questions/67040794/how-can-i-get-the-commit-hash-of-the-latest-release-from-github-api?utm_source=chatgpt.com "How can I get the commit hash of the latest release from ..."))

---

## 表格总结

|功能需求|接口路径 / 方法|
|---|---|
|最新发布版本信息|`GET /repos/{owner}/{repo}/releases/latest`|
|列出所有发布版本|`GET /repos/{owner}/{repo}/releases`|
|通过 tag 查询发布|`GET /repos/{owner}/{repo}/releases/tags/{tag}`|
|获取标签列表|`GET /repos/{owner}/{repo}/tags`|
|获取标签引用（TAG_SHA）|`GET /repos/{owner}/{repo}/git/refs/tags/{tag_name}`|
|获取标签对象详情|`GET /repos/{owner}/{repo}/git/tags/{tag_sha}`|
|列出提交|`GET /repos/{owner}/{repo}/commits`|
|获取指定 commit 信息|`GET /repos/{owner}/{repo}/commits/{commit_sha}`|
|比较两个 commit/tag|`GET /repos/{owner}/{repo}/compare/{base}...{head}`|

---

