From d1cb37a11f3e89ac3a7649acd8870278a3147c54 Mon Sep 17 00:00:00 2001 From: Ryan Chou <88779759+ryanchou1994@users.noreply.github.com> Date: Fri, 4 Sep 2026 12:59:23 +0800 Subject: [PATCH] fix(ci): update references after default branch rename (#556) --- .github/dependabot.yml | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/release.yml | 10 +++++----- CONTRIBUTING.md | 8 ++++---- README.md | 2 +- README_CN.md | 2 +- README_JP.md | 2 +- internal/webui/workflow_test.go | 34 +++++++++++++++++++++++++++++++++ 8 files changed, 49 insertions(+), 15 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3b9c1911..30245c9d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5249eb4..0a2db83d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,10 +3,10 @@ name: V2 CI on: push: branches: - - v2 + - main pull_request: branches: - - v2 + - main permissions: contents: read diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e9c337b5..c710173b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6d189f93..f9d1c511 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/README.md b/README.md index 90366ec4..7bf813ab 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/README_CN.md b/README_CN.md index 504e4514..1b395e0a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -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 diff --git a/README_JP.md b/README_JP.md index ffe01645..3a224a6a 100644 --- a/README_JP.md +++ b/README_JP.md @@ -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 diff --git a/internal/webui/workflow_test.go b/internal/webui/workflow_test.go index 6331b703..d9c3cbe5 100644 --- a/internal/webui/workflow_test.go +++ b/internal/webui/workflow_test.go @@ -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")