Breaking Changes
【免费下载链接】weaviateWeaviate is an open-source vector database that stores both objects and vectors, allowing for the combination of vector search with structured filtering with the fault tolerance and scalability of a cloud-native database.项目地址: https://gitcode.com/GitHub_Trending/we/weaviate
none
New Features
none
Fixes
- <PR 标题> by @<作者登录名> in PR #<编号>
- <PR 标题> by @<作者登录名> in PR #<编号> ...
Full Changelog: compare/<PREVIOUS_VERSION>...<CURRENT_VERSION>
几点值得注意: - 工具默认把 `## Breaking Changes` 与 `## New Features` 都输出为 `*none*`,把**所有拉取到的 PR 统一归入 `## Fixes` 章节**。这是 Weaviate 发布流程的简化约定——发布说明的初稿由工具自动生成,维护者在粘贴前再按实际情况手工调整章节内容; - 每条 PR 条目按 `* 标题 by @作者 in PR #编号` 的 Markdown 列表格式输出,其中标题、作者来自 GitHub API,编号来自本地 Git 提交解析; - 末尾输出 `**Full Changelog**` 行,包含 `PREVIOUS_VERSION...CURRENT_VERSION` 的版本对比信息。 ## 底层原理一:generate_changes.sh 如何筛选提交 [generate_changes.sh](https://link.gitcode.com/i/be0b588f41562aa17cda75a15e84108e) 是整个流程的数据源头,核心只有一条 `git log`: ```bash git --no-pager log $CURRENT_VERSION...$PREVIOUS_VERSION -P --grep="^(Merge pull request.*|.* \(\#[0-9]+\)$)" --pretty=format:'%s'逐个参数拆解:
$CURRENT_VERSION...$PREVIOUS_VERSION:使用 Git 的对称差集语法A...B。由于PREVIOUS_VERSION是CURRENT_VERSION的祖先提交,git log current...previous实际输出的是只在当前版本中存在、上一版本中没有的新提交,即本版本区间内的全部新增提交;-P:启用 Perl 兼容正则;--grep:只匹配两种提交标题形态——Merge pull request.*:GitHub 经典 squash/merge 合并产生的Merge pull request #N from ...标题;.* \(\#[0-9]+\)$:以( #数字 )结尾的提交标题,这是 GitHub squash 合并的默认形态,如fix: foo (#12345);
--pretty=format:'%s':每行只输出提交标题,便于后续逐行解析。
脚本开头的参数校验(generate_changes.sh)要求两个版本参数必填,缺失时输出用法提示并以状态码 1 退出。
底层原理二:main.go 中的 PR 号解析与 API 调用
从提交标题解析 PR 号
printPullRequests()(main.go)逐行读取脚本输出,交给parsePullRequestNumber()(main.go)解析 PR 号。解析器针对上述两种提交形态分别处理:
- 以
Merge pull request #开头:按空格切分后取第 4 段并去掉#,得到纯数字 PR 号; - 否则:按
(#切分,取最后一段再去掉结尾的),得到 PR 号。
这两种格式恰好与generate_changes.sh的--grep正则一一对应,保证筛选出的每一行都能被解析成功。
调用 GitHub API 补齐 PR 信息
getPullRequest()(main.go)对每个 PR 号发起一次 HTTP 请求:
url := fmt.Sprintf("https://api.github.com/repos/weaviate/weaviate/pulls/%s", pr) req.Header.Add("Accept", "application/vnd.github.v3+json") req.Header.Add("Authorization", fmt.Sprintf("token %s", githubToken))请求 GitHub REST API 的 pulls 接口,返回体通过encoding/json反序列化到 pullRequest 结构体:
type pullRequest struct { Number int64 `json:"number"` Title string `json:"title"` User githubUser `json:"user"` } type githubUser struct { Login string `json:"login"` }【免费下载链接】weaviateWeaviate is an open-source vector database that stores both objects and vectors, allowing for the combination of vector search with structured filtering with the fault tolerance and scalability of a cloud-native database.项目地址: https://gitcode.com/GitHub_Trending/we/weaviate
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考