fix(ci): update references after default branch rename (#556)

This commit is contained in:
Ryan Chou authored and GitHub committed 2026-09-04 12:59:23 +08:00
1 parent 097029ff09
commit d1cb37a11f
8 files changed
+49 -15

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
# 仓库已对所有 action 强制 SHA pin,上游补丁不会自动到达;由 Dependabot 提 PR
# 更新 SHA 并同步刷新其后的版本注释,保持"可审计"与"能更新"同时成立。
#
# 不要声明 target-branch。Dependabot 默认就针对默认分支(当前为 v2),而一旦声明
# 不要声明 target-branch。Dependabot 默认就针对默认分支(当前为 main),而一旦声明
# target-branch,本文件对该 ecosystem 的配置就不再作用于 security update,
# groups、labels 与 commit-message 会对安全更新 PR 全部失效。
# https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference
+2 -2
View File
@@ -3,10 +3,10 @@ name: V2 CI
on:
push:
branches:
- v2
- main
pull_request:
branches:
- v2
- main
permissions:
contents: read
+5 -5
View File
@@ -105,11 +105,11 @@ jobs:
} >>"${GITHUB_OUTPUT}"
# release-tag-validation:end
- name: Require tag commit in v2 history
- name: Require tag commit in main history
shell: bash
run: |
git fetch --no-tags origin v2
git merge-base --is-ancestor "${GITHUB_SHA}" origin/v2
git fetch --no-tags origin main
git merge-base --is-ancestor "${GITHUB_SHA}" origin/main
- name: Reuse CI verdict for this commit
id: ci
@@ -731,8 +731,8 @@ jobs:
set -euo pipefail
test "$(git rev-parse HEAD)" = "${GITHUB_SHA}"
test "$(git rev-parse "${GITHUB_REF_NAME}^{commit}")" = "${GITHUB_SHA}"
git fetch --no-tags origin v2
git merge-base --is-ancestor "${GITHUB_SHA}" origin/v2
git fetch --no-tags origin main
git merge-base --is-ancestor "${GITHUB_SHA}" origin/main
- name: Verify complete release asset set
run: .github/scripts/release-verify-assets.sh release
+4 -4
View File
@@ -18,10 +18,10 @@ Thanks for helping improve GPT-Load. This document covers what a human contribut
`2.x` 与 `1.x` 是两套不兼容的实现,数据不互通。
- **2.x 开发基于 `v2` 分支**,PR 也提交到 `v2`。
- **2.x 开发基于 `main` 分支**,PR 也提交到 `main`。
- `1.x` 处于维护状态,只接受安全和严重缺陷修复。
`2.x` and `1.x` are incompatible implementations and do not share data. Base 2.x work on the **`v2` branch** and target your PR at `v2`. The `1.x` line is in maintenance and only takes security and critical bug fixes.
`2.x` and `1.x` are incompatible implementations and do not share data. Base 2.x work on the **`main` branch** and target your PR at `main`. The `1.x` line is in maintenance and only takes security and critical bug fixes.
## 本地开发 / Local development
@@ -56,13 +56,13 @@ Race tests for that module run in CI; per repository convention they are not run
## 提交 PR / Submitting a pull request
1. 从 `v2` 切出分支,保持改动聚焦,不要夹带无关重构或格式化。
1. 从 `main` 切出分支,保持改动聚焦,不要夹带无关重构或格式化。
2. 修复缺陷或改变行为时,优先补一个能复现问题的测试。
3. 提交前跑一次 `make check`;无法运行时在 PR 里说明原因和未验证范围。
4. 按 `.github/pull_request_template.md` 填写,如实勾选自查清单。
5. 改动涉及用户可见能力时,**三份 README(`README.md`、`README_CN.md`、`README_JP.md`)必须同步更新**。
1. Branch from `v2`, keep the change focused, and avoid unrelated refactors or reformatting.
1. Branch from `main`, keep the change focused, and avoid unrelated refactors or reformatting.
2. For bug fixes and behavior changes, add a test that reproduces the problem first.
3. Run `make check` before submitting; if you cannot, say why and what remains unverified.
4. Fill in `.github/pull_request_template.md` honestly, including the checklist.
+1 -1
View File
@@ -65,7 +65,7 @@ Your application only needs one base URL and one AccessKey. Providers, accounts,
Requires Docker and Docker Compose.
```bash
git clone --depth 1 --branch v2 https://github.com/tbphp/gpt-load.git
git clone --depth 1 https://github.com/tbphp/gpt-load.git
cd gpt-load
cp .env.example .env
+1 -1
View File
@@ -65,7 +65,7 @@
需要 Docker 与 Docker Compose。
```bash
git clone --depth 1 --branch v2 https://github.com/tbphp/gpt-load.git
git clone --depth 1 https://github.com/tbphp/gpt-load.git
cd gpt-load
cp .env.example .env
+1 -1
View File
@@ -65,7 +65,7 @@ API キー、サブスクリプションアカウント、トラフィック制
Docker と Docker Compose が必要です。
```bash
git clone --depth 1 --branch v2 https://github.com/tbphp/gpt-load.git
git clone --depth 1 https://github.com/tbphp/gpt-load.git
cd gpt-load
cp .env.example .env
+34
View File
@@ -81,6 +81,40 @@ func TestMakeCheckDoesNotDuplicateWebTypeCheck(t *testing.T) {
}
}
func TestBranchAndReleaseWorkflowsFollowDefaultBranch(t *testing.T) {
ci := readRepositoryFile(t, ".github/workflows/ci.yml")
triggers := workflowTopLevelBlock(t, ci, "on")
for _, required := range []string{
"push:\n branches:\n - main",
"pull_request:\n branches:\n - main",
} {
if !strings.Contains(triggers, required) {
t.Fatalf("branch CI triggers do not contain %q:\n%s", required, triggers)
}
}
if strings.Contains(triggers, " - v2") {
t.Fatalf("branch CI still targets the removed v2 branch:\n%s", triggers)
}
release := readRepositoryFile(t, ".github/workflows/release.yml")
for _, required := range []struct {
value string
count int
}{
{value: "git fetch --no-tags origin main", count: 2},
{value: `git merge-base --is-ancestor "${GITHUB_SHA}" origin/main`, count: 2},
} {
if count := strings.Count(release, required.value); count != required.count {
t.Fatalf("release workflow contains %q %d times, want %d", required.value, count, required.count)
}
}
for _, forbidden := range []string{"origin/v2", "Require tag commit in v2 history"} {
if strings.Contains(release, forbidden) {
t.Fatalf("release workflow still contains removed branch reference %q", forbidden)
}
}
}
func TestBranchAndReleaseWorkflowsRunRaceInParallelGates(t *testing.T) {
content := readRepositoryFile(t, ".github/workflows/ci.yml")
testJob := workflowJobBlock(t, content, "test")