Skip to content

feat(ci): support independent G2 release lines - #818

Merged
BLumia merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:feat/multi-release-lines-20261117
Nov 20, 2026
Merged

BLumia merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:feat/multi-release-lines-20261117

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

背景

G2 当前只有一套组版本和发布分支,无法让多个版本线并行准备、发布和记录状态。本 PR 为成员侧提供独立发布线所需的 workflow 入口、模板同步和实时保护校验。

变更

  • 新增 Prepare release line,按已合并的发布线配置创建固定 SHA 成员分支。
  • 复用现有 templates-sync,一次同步 17 个成员的发版与 guard 模板,不再创建逐成员、逐分支的模板 PR。
  • 同步后读回默认分支和目标分支,校验 workflow 启用、共享引用和实际分支保护。
  • guard 支持根据成员 PR 的 base.ref 唯一反查 G2 发布线,并校验对应发布记录。
  • 17 份成员 JSON 的应用/guard 模板配置覆盖 master、develop/.+ 与 release/.+。
  • 保护配置继续保留已有必需检查,并将 group-version-guard 绑定到受保护的发布 GitHub App。

验证

  • Prepare 离线测试:18/18。
  • 共享 checks / Propose 测试:23/23。
  • Python 编译、workflow YAML 解析和 git diff --check 通过。
  • 测试组织已完成真实 Prepare:17/17 成员 READY,统一模板同步成功,分支保护读回成功。

配对 PR:linuxdeepin/dde#7

Summary by Sourcery

Enable independent G2 release lines with automated member-branch preparation, shared template synchronization, and release-line-aware workflow and protection validation.

New Features:

  • Add a workflow to prepare independent G2 release lines by creating fixed-SHA member branches and validating their readiness.
  • Support release-line-aware group-version checks for G2 member pull requests and release records.
  • Synchronize release-line update and guard templates across all G2 member repositories.

Bug Fixes:

  • Preserve existing branch protection checks and review policies while enforcing the group-version guard through the release GitHub App.
  • Ensure disabled workflows are re-enabled and effective branch protection is read back and verified after preparation.

Enhancements:

  • Strengthen G2 validation for Linglong package versions, release-line mapping, branch ancestry, and release metadata consistency.
  • Allow template synchronization from the repository default branch and consolidate release-line template updates into the shared sync workflow.

CI:

  • Add safeguards for trusted configuration, App repository access, branch creation permissions, and concurrent release-line preparation.

@sourcery-ai

sourcery-ai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Review the reusable group-version workflow interface and its inherited App secrets, permissions, and guard-status reporting.

  • .github/workflows/verify-group-version.yml L27-40, L96-143, L179-205 (+10 small edits)
  • workflow-templates/call-verify-group-version.yml L15

Implementation

Review the preparation logic that validates trusted release-line configuration, preflights all members, creates fixed-SHA branches, synchronizes templates, and verifies protections.

  • .github/scripts/prepare_release_line.py L1-399

Configuration

Review the dispatchable preparation workflow, its trust and permission boundaries, and the default-branch template-sync changes used by preparation.

  • .github/workflows/prepare-release-line.yml L1-97
  • .github/workflows/templates-sync.yml L86-136 (+5 small edits)

Review the 17 member template configurations together to verify release-line branch coverage and shared workflow sources.

  • repos/linuxdeepin/dde-api.json L72-75, L82-84
  • repos/linuxdeepin/dde-appearance.json L62-65, L72-74
  • repos/linuxdeepin/dde-application-manager.json L62-65, L72-74
  • repos/linuxdeepin/dde-control-center.json L88-91, L98-100
  • repos/linuxdeepin/dde-daemon.json L72-75, L82-84
  • repos/linuxdeepin/dde-launchpad.json L74-77, L84-86
  • repos/linuxdeepin/dde-network-core.json L93-96, L103-105
  • repos/linuxdeepin/dde-services.json L3-6, L13-15
  • repos/linuxdeepin/dde-session-shell-snipe.json L3-6, L13-15
  • repos/linuxdeepin/dde-session.json L62-65, L72-74
  • repos/linuxdeepin/dde-shell.json L74-77, L84-86
  • repos/linuxdeepin/dde-tray-loader.json L55-58, L65-67
  • repos/linuxdeepin/deepin-service-manager.json L87-90, L97-99
  • repos/linuxdeepin/deepin-update-ui.json L65-68, L75-77
  • repos/linuxdeepin/go-dbus-factory.json L62-65, L82-84
  • repos/linuxdeepin/go-lib.json L72-75, L82-84
  • repos/linuxdeepin/xdg-desktop-portal-dde.json L62-65, L72-74

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 15 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/prepare-release-line.yml" line_range="4" />
<code_context>
+name: Prepare release line
+
+on:
+  workflow_dispatch:
+    inputs:
+      release_line:
</code_context>
<issue_to_address>
**Write users inherit App privileges**

When a user with write access to the coordinator repository dispatches the workflow with `dry_run` false and a configured release line, the workflow mints an installation token with organization-wide Contents/Actions write and, when available, Administration write, then passes it to `prepare()` to create member branches and update their protections. A user who can dispatch this workflow can therefore exercise the App’s broader privileges across the 17 repositories.

Restrict dispatch to an explicitly authorized maintainer set or require approval through a protected environment before minting the elevated token.
</issue_to_address>

### Comment 2
<location path=".github/scripts/prepare_release_line.py" line_range="177" />
<code_context>
+                if name != GUARD_CONTEXT and name in checks and checks[name] != binding:
+                    raise RuntimeError(f"同一必需检查 {name} 有冲突 App 绑定,不能覆盖现有规则")
+                checks[name] = binding
+    checks[GUARD_CONTEXT] = app_id
+    payload = {
+        "required_status_checks": {"strict": True, "checks": [
</code_context>
<issue_to_address>
**Guard status can be forged**

When a contributor who can push a branch adds a `pull_request` workflow with `statuses: write` and posts success for the PR head, a PR-controlled workflow can use its `GITHUB_TOKEN` with `statuses: write` to post a successful `group-version-guard` status under the same GitHub Actions App identity required by this protection. The version guard is therefore bypassable, allowing an otherwise eligible PR with an invalid release version to satisfy this check.

Publish and require the guard result under a dedicated GitHub App identity whose credentials are unavailable to PR-controlled workflows.
</issue_to_address>

### Comment 3
<location path=".github/scripts/prepare_release_line.py" line_range="344-351" />
<code_context>
+            check_member_workflows(api, repo, branch)
+            state = "PROTECTION_FAILED"
+            app_source = actions_app_id(api)
+            target = read_protection(api, repo, branch)
+            if not protection_ready(target, app_source):
+                default = read_protection(api, repo, row["default"])
+                payload = protection_payload(target, default, app_source)
+                if not admin_write:
+                    raise ReadinessError(state, f"{repo} App 无 Admin Write;管理员保留现有审核/检查并配置"
+                                         f"保护后重跑: https://github.com/{repo}/settings/branches")
+                api(f"repos/{repo}/branches/{quote(branch, safe='')}/protection", payload, method="PUT")
+                observed = read_protection(api, repo, branch)
+                verify_preserved(observed, payload, app_source)
</code_context>
<issue_to_address>
**Concurrent protection edits disappear**

When an administrator changes target-branch protection after Prepare reads it but before Prepare writes the payload, the protection payload is built from `target` as read before the PUT. If an administrator adds a required check or changes another protection setting between that read and the PUT, the update replaces the intervening policy with the stale payload, and the new requirement disappears.

Use a conditional update if supported, or re-read and compare protection immediately before writing, aborting and rebuilding the payload when it changed.
</issue_to_address>

### Comment 4
<location path=".github/scripts/prepare_release_line.py" line_range="148" />
<code_context>
+    reviews.pop("url", None)
+    if "dismissal_restrictions" in reviews:
+        reviews["dismissal_restrictions"] = _actors(reviews["dismissal_restrictions"])
+    reviews["bypass_pull_request_allowances"] = {"users": [], "teams": [], "apps": []}
+    reviews.setdefault("required_approving_review_count", 0)
+    reviews.setdefault("dismiss_stale_reviews", False)
</code_context>
<issue_to_address>
**Review bypass access disappears**

When the source branch has configured pull-request review bypass allowances, `protection_payload` replaces the existing user, team, and app allowances with empty lists, so applying protection removes those bypass rights and disrupts the usual merge path.

Preserve the source branch’s existing pull-request bypass allowances in the protection payload.
</issue_to_address>

### Comment 5
<location path=".github/scripts/prepare_release_line.py" line_range="331" />
<code_context>
+    if any(content(api, row["repo"], f".github/workflows/{name}", base, missing=True) != text
+           for row in rows for base in dict.fromkeys((row["default"], branch))
+           for name, text in row["templates"].items()):
+        sync_templates(api, coordinator.split("/")[0])
+    for row in rows:
+        state = "TEMPLATE_MISSING"
</code_context>
<issue_to_address>
**Concurrent sync aborts preparation**

When two release-line preparations dispatch template synchronization before the first sync completes, the shared templates-sync concurrency group cancels the in-progress run, and `sync_templates` treats the canceled run as a failure when it appears in the poll; Prepare then exits after creating branches, leaving setup incomplete.

Prevent one release-line sync dispatch from canceling another, or make the polling logic wait for the replacement run before treating cancellation as a failure.

Also at `.github/workflows/prepare-release-line.yml:20`, `.github/scripts/prepare_release_line.py:214-219`, `.github/scripts/prepare_release_line.py:221`.
</issue_to_address>

### Comment 6
<location path=".github/workflows/templates-sync.yml" line_range="17" />
<code_context>
   templates-sync:
     # limit push on linuxdeepin/.github master branch
-    if: github.repository == 'linuxdeepin/.github' && github.ref == 'refs/heads/master'
+    if: github.repository == 'linuxdeepin/.github' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
     runs-on: ubuntu-latest
     steps:
</code_context>
<issue_to_address>
**Organization-specific sync job skips**

When prepare dispatches templates-sync from a `.github` repository outside `linuxdeepin`, the job condition requires `github.repository` to equal `linuxdeepin/.github`, so the dispatched job skips; `sync_templates` then times out and Prepare leaves created branches without synchronized workflows or protection checks.

Allow the job to run in the dispatched organization’s `.github` repository while retaining the default-branch condition.
</issue_to_address>

### Comment 7
<location path=".github/workflows/verify-group-version.yml" line_range="213-214" />
<code_context>
               if (after != target or source["full_name"] != repo or pr["head"]["ref"] != branch
                       or pr["base"]["ref"] != member["base"] or pr["created_at"] < release["started_at"]):
                   raise RuntimeError(f"{repo} 的改版 PR 不属于 {group} 本轮 {target},请从 DDE Release group 发起")
+              for path, version in recipes.items():
</code_context>
<issue_to_address>
**Release-line changelog branches collide**

When two release lines for the same member use the same target version, the changelog workflow names its head branch only from the target version, so both runs push to the same branch and the later run overwrites the earlier changes; a PR can then represent the wrong release line.

Include the release-line identity in the changelog head branch name and have the version guard validate that distinct branch.

Also at `.github/workflows/verify-group-version.yml:172`.
</issue_to_address>

### Comment 8
<location path=".github/scripts/prepare_release_line.py" line_range="317" />
<code_context>
+            target = branch_info(api, row["repo"], branch, missing=True)
+            if target is None:
+                try:
+                    api(f"repos/{row['repo']}/git/refs", {"ref": f"refs/heads/{branch}", "sha": row["base"]})
+                except RuntimeError:
+                    target = branch_info(api, row["repo"], branch, missing=True)
</code_context>
<issue_to_address>
**Changed config leaves stale branches**

When the DDE default branch changes release-line bases or mappings after the live-config comparison but before member refs are created, prepare continues using the earlier `lines` and `rows` snapshot, so it creates branches from bases no longer configured for the release line and leaves those branches in place.

Refresh and validate the live release-line configuration before creating member refs, aborting if it no longer matches the reviewed configuration.

Also at `.github/scripts/prepare_release_line.py:310-313`.
</issue_to_address>

### Comment 9
<location path=".github/scripts/prepare_release_line.py" line_range="355" />
<code_context>
+                observed = read_protection(api, repo, branch)
+                verify_preserved(observed, payload, app_source)
+            check_member_ready(api, repo, branch)
+            row.update(state="READY", detail="已读回验证入口、workflow 启用与实际有效保护")
+        except ReadinessError as error:
+            row.update(state=error.state, detail=str(error))
</code_context>
<issue_to_address>
**Ready branch no longer contains base**

When a writer changes a newly created member branch after the ancestry check and before protection is applied, `check_member_ready` does not recheck ancestry, so Prepare can report READY even though the branch no longer contains its configured base SHA.

Recheck that each branch descends from its configured base immediately before reporting it READY.

Also at `.github/scripts/prepare_release_line.py:324-331`.
</issue_to_address>

### Comment 10
<location path=".github/scripts/prepare_release_line.py" line_range="86" />
<code_context>
+            continue
+        if rule.get("blocksCreations") is None or rule.get("restrictsPushes") is None:
+            raise RuntimeError(f"{repo}:{branch} 创建保护权限未知")
+        if rule["blocksCreations"] and rule["restrictsPushes"]:
+            allowances = rule["pushAllowances"]
+            if allowances["totalCount"] != len(allowances["nodes"]) or not any(
</code_context>
<issue_to_address>
**Blocked branches are partially created**

When a matching classic protection rule blocks creations without also restricting pushes, `_may_create` skips a matching classic rule when `blocksCreations` is true but `restrictsPushes` is false, so the preflight accepts a branch the rule blocks. The later ref-creation loop can then fail after creating branches for earlier members, leaving a partial setup that requires a rerun.

Treat every matching `blocksCreations` rule as a creation restriction and verify the App can bypass it before any writes.
</issue_to_address>

### Comment 11
<location path=".github/workflows/templates-sync.yml" line_range="117" />
<code_context>
+              names[name].write_text(json.dumps(entries, ensure_ascii=False), encoding="utf-8")
+          PY
+
+      - name: Sync release-line update template
+        if: github.event_name == 'workflow_dispatch'
+        uses: linuxdeepin/action-sync@main
</code_context>
<issue_to_address>
**Develop dispatch targets master**

When a maintainer runs the synced workflow from a develop branch and accepts its default inputs, the synced caller keeps `base_branch` defaulted to `master` and passes it to the reusable workflow, which checks out that branch. A maintainer running the newly available workflow from a `develop/...` branch with the defaults therefore generates the changelog and PR for master instead of the selected release line.

Make the caller default its base branch to the selected workflow ref, or otherwise require an explicit branch for non-master runs.
</issue_to_address>

### Comment 12
<location path=".github/tests/test_prepare_release_line.py" line_range="72" />
<code_context>
+                    files = self.github.files[repo, sha]
+                    files.update({f".github/workflows/{name}": text
+                                  for name, text in self.github.templates.items()})
+                    self.github.add_commit(repo, files, [sha], branch=branch, message="template sync")
+            self.sync_runs.insert(0, {
+                "id": 900 + self.sync_dispatches, "status": "completed", "conclusion": "success",
</code_context>
<issue_to_address>
**Mocked sync masks workflow failures**

When the real templates-sync workflow fails or skips its updates after dispatch, `test_template_sync_updates_existing_branch_without_pr` relies on the API stub to create commits with the template files at line 72, so the test passes even if the real templates-sync workflow fails to update any branch.

Test the templates-sync workflow's dispatch path and verify its actual sync behavior rather than having the API stub perform the sync.
</issue_to_address>

### Comment 13
<location path=".github/tests/test_verify_group_version.py" line_range="748" />
<code_context>
+                        PR_HEAD_SHA='previous-head'):
+            with patch('builtins.open', mock_open(read_data=json.dumps({'number': 1}))):
+                with self.assertRaisesRegex(RuntimeError, 'PR 提交已变化'):
+                    self.ns['main']()
+
+    def test_epoch_version_cannot_be_silently_downgraded(self):
</code_context>
<issue_to_address>
**Closed-PR test accepts no-op**

When the test runs with the closed-PR event fixture, `test_closed_pr_recomputes_only_remaining_open_prs` only calls `self.ns['main']()` at line 748 and makes no assertion, so a no-op `main` passes while the shared status remains stale.

Assert that `main` checks the remaining open PRs and publishes the expected status.
</issue_to_address>

### Comment 14
<location path=".github/scripts/prepare_release_line.py" line_range="1" />
<code_context>
+"""Prepare only the 17 G2 members from the merged, trusted dde configuration."""
+
+import copy
</code_context>
<issue_to_address>
**New files lack SPDX headers**

The new script, tests, and workflow have no SPDX header at the file start, so they do not identify the required copyright year or license.

Add a current-year SPDX copyright line and an appropriate SPDX license identifier to each new file, using the required comment prefix for its file type.

Also at `.github/tests/test_prepare_release_line.py:1`, `.github/tests/test_verify_group_version.py:1`, `.github/workflows/prepare-release-line.yml:1`.
</issue_to_address>

### Comment 15
<location path=".github/workflows/templates-sync.yml" line_range="17" />
<code_context>
   templates-sync:
     # limit push on linuxdeepin/.github master branch
-    if: github.repository == 'linuxdeepin/.github' && github.ref == 'refs/heads/master'
+    if: github.repository == 'linuxdeepin/.github' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
     runs-on: ubuntu-latest
     steps:
</code_context>
<issue_to_address>
**Modified workflows lack SPDX years**

Both modified workflows still have no SPDX copyright header, so their copyright years are not updated to reflect this change.

Add an SPDX copyright header with the current year and an appropriate license identifier to each modified workflow.

Also at `.github/workflows/verify-group-version.yml:36`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

if name != GUARD_CONTEXT and name in checks and checks[name] != binding:
raise RuntimeError(f"同一必需检查 {name} 有冲突 App 绑定,不能覆盖现有规则")
checks[name] = binding
checks[GUARD_CONTEXT] = app_id

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Guard status can be forged

When a contributor who can push a branch adds a pull_request workflow with statuses: write and posts success for the PR head, a PR-controlled workflow can use its GITHUB_TOKEN with statuses: write to post a successful group-version-guard status under the same GitHub Actions App identity required by this protection. The version guard is therefore bypassable, allowing an otherwise eligible PR with an invalid release version to satisfy this check.

Publish and require the guard result under a dedicated GitHub App identity whose credentials are unavailable to PR-controlled workflows.

Prompt for AI agents
In `.github/scripts/prepare_release_line.py` at line 177:

**Guard status can be forged**

When a contributor who can push a branch adds a `pull_request` workflow with `statuses: write` and posts success for the PR head, a PR-controlled workflow can use its `GITHUB_TOKEN` with `statuses: write` to post a successful `group-version-guard` status under the same GitHub Actions App identity required by this protection. The version guard is therefore bypassable, allowing an otherwise eligible PR with an invalid release version to satisfy this check.

Publish and require the guard result under a dedicated GitHub App identity whose credentials are unavailable to PR-controlled workflows.

Comment thread .github/scripts/prepare_release_line.py Resolved
reviews.pop("url", None)
if "dismissal_restrictions" in reviews:
reviews["dismissal_restrictions"] = _actors(reviews["dismissal_restrictions"])
reviews["bypass_pull_request_allowances"] = {"users": [], "teams": [], "apps": []}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Review bypass access disappears

When the source branch has configured pull-request review bypass allowances, protection_payload replaces the existing user, team, and app allowances with empty lists, so applying protection removes those bypass rights and disrupts the usual merge path.

Preserve the source branch’s existing pull-request bypass allowances in the protection payload.

Prompt for AI agents
In `.github/scripts/prepare_release_line.py` at line 148:

**Review bypass access disappears**

When the source branch has configured pull-request review bypass allowances, `protection_payload` replaces the existing user, team, and app allowances with empty lists, so applying protection removes those bypass rights and disrupts the usual merge path.

Preserve the source branch’s existing pull-request bypass allowances in the protection payload.

if any(content(api, row["repo"], f".github/workflows/{name}", base, missing=True) != text
for row in rows for base in dict.fromkeys((row["default"], branch))
for name, text in row["templates"].items()):
sync_templates(api, coordinator.split("/")[0])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Concurrent sync aborts preparation

When two release-line preparations dispatch template synchronization before the first sync completes, the shared templates-sync concurrency group cancels the in-progress run, and sync_templates treats the canceled run as a failure when it appears in the poll; Prepare then exits after creating branches, leaving setup incomplete.

Prevent one release-line sync dispatch from canceling another, or make the polling logic wait for the replacement run before treating cancellation as a failure.

Also at .github/workflows/prepare-release-line.yml:20, .github/scripts/prepare_release_line.py:214-219, .github/scripts/prepare_release_line.py:221.

Prompt for AI agents
In `.github/scripts/prepare_release_line.py` at line 331:

**Concurrent sync aborts preparation**

When two release-line preparations dispatch template synchronization before the first sync completes, the shared templates-sync concurrency group cancels the in-progress run, and `sync_templates` treats the canceled run as a failure when it appears in the poll; Prepare then exits after creating branches, leaving setup incomplete.

Prevent one release-line sync dispatch from canceling another, or make the polling logic wait for the replacement run before treating cancellation as a failure.

Also at `.github/workflows/prepare-release-line.yml:20`, `.github/scripts/prepare_release_line.py:214-219`, `.github/scripts/prepare_release_line.py:221`.

names[name].write_text(json.dumps(entries, ensure_ascii=False), encoding="utf-8")
PY

- name: Sync release-line update template

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Develop dispatch targets master

When a maintainer runs the synced workflow from a develop branch and accepts its default inputs, the synced caller keeps base_branch defaulted to master and passes it to the reusable workflow, which checks out that branch. A maintainer running the newly available workflow from a develop/... branch with the defaults therefore generates the changelog and PR for master instead of the selected release line.

Make the caller default its base branch to the selected workflow ref, or otherwise require an explicit branch for non-master runs.

Prompt for AI agents
In `.github/workflows/templates-sync.yml` at line 117:

**Develop dispatch targets master**

When a maintainer runs the synced workflow from a develop branch and accepts its default inputs, the synced caller keeps `base_branch` defaulted to `master` and passes it to the reusable workflow, which checks out that branch. A maintainer running the newly available workflow from a `develop/...` branch with the defaults therefore generates the changelog and PR for master instead of the selected release line.

Make the caller default its base branch to the selected workflow ref, or otherwise require an explicit branch for non-master runs.

Comment thread .github/scripts/prepare_release_line.py Resolved
Comment thread .github/workflows/templates-sync.yml Resolved
@MyLeeJiEun
MyLeeJiEun force-pushed the feat/multi-release-lines-20261117 branch from 85be53f to ae1df0a Compare November 18, 2026 02:02
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 98 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交为 DDE CI/CD 基础设施新增 G2 独立发布线支持,包含新增 prepare_release_line.py 脚本、 prepare-release-line.yml 工作流、templates-sync.yml 与 verify-group-version.yml 工作流增强, 以及 17 个 JSON 配置文件从 branch 迁移到 branches 以支持 develop/ 分支。代码整体质量优秀, 防御性编程充分,输入校验严格,subprocess 全部使用列表形式无注入风险,yaml.safe_load 安全加载, GitHub App Token 通过 actions/create-github-app-token 安全管理。仅 prepare() 函数略长(约120行), 建议后续拆分。无安全漏洞,四维度均通过。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['建议为 _ancestors、_installation_repositories、_creation_rules 等内部函数补充简短注释说明参数含义']


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['建议将 prepare() 函数拆分为 _dry_run_check 和 _execute 两个子函数', '建议为缺少 docstring 的函数补充简短说明']


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: ['建议持续保持当前的输入校验和防御性编程水平']


💡 改进建议代码示例

# 建议:将 prepare() 函数拆分为 dry_run 和 execute 两个阶段
def _dry_run_check(api, rows, branch):
    """Dry-run: verify each member is ready without making changes."""
    for row in rows:
        try:
            if row["operation"] == "create":
                raise ReadinessError("BRANCH_MISSING", f"将从固定基准 {row['base']} 创建")
            if any(content(api, row["repo"], f".github/workflows/{name}", base, missing=True) != text
                   for base in dict.fromkeys((row["default"], branch))
                   for name, text in row["templates"].items()):
                raise ReadinessError("TEMPLATE_MISSING", "正式运行将调用统一模板同步")
            check_member_ready(api, row["repo"], branch)
            row["state"] = "READY"
        except ReadinessError as error:
            row.update(state=error.state, detail=str(error))
        except Exception as error:
            row.update(state="PROTECTION_FAILED", detail=str(error))
    _report(rows)
    return rows

def _execute_create(api, rows, branch):
    """Execute: create branches, sync templates, and configure protection."""
    for row in rows:
        try:
            target = branch_info(api, row["repo"], branch, missing=True)
            if target is None:
                try:
                    api(f"repos/{row['repo']}/git/refs",
                        {"ref": f"refs/heads/{branch}", "sha": row["base"]})
                except RuntimeError:
                    target = branch_info(api, row["repo"], branch, missing=True)
                    if target is None:
                        raise
                target = branch_info(api, row["repo"], branch)
            _ancestors(api, row["repo"], row["base"], target["commit"]["sha"])
        except Exception as error:
            row.update(operation="conflict", detail=str(error))
            _report(rows)
            raise RuntimeError("分支创建中断;保留所有已创建分支,重跑只补缺失项") from error

本报告由 AI 代码审查工具自动生成

@MyLeeJiEun
MyLeeJiEun force-pushed the feat/multi-release-lines-20261117 branch 5 times, most recently from af1246e to 9cf2d18 Compare November 19, 2026 12:00
1. Add release-line preparation workflows with fixed base SHAs.
2. Keep member workflows on the existing base_branch input.
3. Validate release-line mappings, guard records, templates, and protections.
4. Reuse one template sync and preserve app-bound required checks.

Log: Add isolated G2 release-line preparation and verification.
Influence: Enables independent G2 release lines.

feat(ci): 支持独立 G2 发布线

1. 新增发布线准备流程,并固定成员基准 SHA。
2. 成员 workflow 继续复用 base_branch 输入。
3. 校验发布线映射、guard 记录、模板与分支保护。
4. 复用统一模板同步并保留 App 绑定必需检查。

Log: 新增隔离的 G2 发布线准备与校验能力。
PMS: TASK-398637
Influence: 支持多条 G2 发布线独立推进。
@MyLeeJiEun
MyLeeJiEun force-pushed the feat/multi-release-lines-20261117 branch from 9cf2d18 to 90115d0 Compare November 19, 2026 13:58
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, MyLeeJiEun

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@BLumia
BLumia merged commit 5c30778 into linuxdeepin:master Nov 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants