Skip to content

Update GitCode release workflow inputs#218

Merged
mkdir700 merged 6 commits intomainfrom
mkdir700/gitcode-upload-timeout
Oct 16, 2025
Merged

Update GitCode release workflow inputs#218
mkdir700 merged 6 commits intomainfrom
mkdir700/gitcode-upload-timeout

Conversation

@mkdir700
Copy link
Owner

@mkdir700 mkdir700 commented Oct 16, 2025

Background

The GitCode release workflow's manual trigger inputs were not aligned with the desired user experience for selecting release tags. Previously, tag_name was a required input, forcing users to always provide it.

Changes

  • .github/workflows/sync-release-to-gitcode.yml:
    • Removed the tag_name input, as it's now derived from the selected ref (tag or branch).
    • Updated the release_name input description to clarify it's optional and defaults to the tag name.
    • Updated the release_body input description to clarify it's optional and fetched from GitHub if not provided.
    • Modified the workflow_dispatch job logic to correctly handle manual triggers:
      • It now inspects github.ref_name and github.ref_type to determine if a tag or branch was selected.
      • If a tag is selected, TAG_NAME is set directly from github.ref_name.
      • If a branch is selected, it attempts to extract a version tag (e.g., v1.0.0) from the branch name. If extraction fails, it exits with an informative error message.
      • The logic for fetching the release body from the GitHub API when release_body is not provided has been refined to use the determined TAG_NAME.

Testing

  • Manually trigger the workflow and select a tag from the "Tags" tab. Verify the workflow uses the selected tag.
  • Manually trigger the workflow and select a branch with a version in its name (e.g., release/v1.2.3). Verify the workflow extracts the tag correctly.
  • Manually trigger the workflow and select a branch without a version. Verify the workflow exits with an appropriate error.
  • Test providing optional release_name and release_body inputs.

Summary by CodeRabbit

发布说明

  • 新功能

    • 大文件上传现已支持扩展超时时间(默认10分钟,最长30分钟)。
    • 添加上传进度报告功能,显示传输速度和连接状态。
  • 改进

    • 优化发布流程自动化,简化手动触发参数。
    • 改进上传失败信息和性能指标显示。

mkdir700 and others added 6 commits October 16, 2025 21:23
Add comprehensive timeout handling and progress logging for large
file uploads to prevent hanging during asset sync:

- Add configurable timeout (default 10min, 30min for uploads)
- Add progress monitoring for socket connection and data transfer
- Accept all 2xx status codes as success (not just 200)
- Improve error messages with detailed status and timing info
- Show upload speed and duration for better debugging

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove the need for users to manually input tag_name when triggering
the GitCode sync workflow. The workflow now automatically extracts the
version tag from the branch name.

Supported branch name patterns:
- release/v1.0.0
- mkdir700/v1.0.0
- conductor/v1.0.0
- v1.0.0
- etc.

This improves the workflow UX by reducing manual input and ensuring
consistency between branch names and release tags.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update workflow to properly handle GitHub Actions UI where users can:
1. Select a tag directly from the "Tags" tab (preferred method)
2. Or use a branch name containing a version tag (fallback)

The workflow now checks github.ref_type to determine if the selected
ref is a tag or branch, and handles both cases appropriately.

This provides a better UX by supporting the native GitHub tag selection
interface while maintaining backward compatibility with branch-based
workflows.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Caution

Review failed

The pull request is closed.

概览

此次更改调整了发布工作流程的触发机制与标签派生逻辑,并增强了资源上传脚本的超时处理、进度报告及 HTTP 响应处理能力,以支持更大规模的上传操作。

变更内容

内聚体 / 文件 变更摘要
工作流程触发及标签派生
.github/workflows/sync-release-to-gitcode.yml
移除 tag_name 工作流触发输入;基于 github.ref_namegithub.ref_type 重新派生 TAG_NAME;若为标签则直接使用,若为分支则尝试从分支名提取版本标签;更新 release_namerelease_body 的输入描述;当未提供 release_body 时,使用 TAG_NAME 从 GitHub 获取发布体描述
资源上传脚本增强
scripts/upload-assets.js
新增扩展超时处理机制(默认 10 分钟,可通过选项覆盖);引入大型响应进度报告(每 1 MB 记录接收字节数);实现请求级超时与销毁机制;添加套接字连接事件日志;升级为 HTTP 状态感知的成功/失败处理;集成上传耗时与速度计算(MB/s);改进错误消息前缀与上下文信息;增强资源上传过程中的控制台输出

序列图

sequenceDiagram
    participant User
    participant Workflow as 工作流程
    participant GitHub as GitHub API
    participant Uploader as 上传脚本

    rect rgb(240, 248, 255)
    Note over Workflow: 标签派生阶段
    User->>Workflow: 触发工作流(选择 ref)
    Workflow->>Workflow: 检查 ref_type
    alt ref_type = tag
        Workflow->>Workflow: 直接使用 ref_name 作为 TAG_NAME
    else ref_type = branch
        Workflow->>Workflow: 从分支名提取版本标签
        alt 提取成功
            Workflow->>Workflow: TAG_NAME = 提取的版本
        else 提取失败
            Workflow->>Workflow: 错误退出
        end
    end
    end

    rect rgb(240, 255, 240)
    Note over Workflow: 发布体获取阶段
    alt release_body 已提供
        Workflow->>Workflow: 使用提供的 release_body
    else release_body 未提供
        Workflow->>GitHub: 基于 TAG_NAME 获取发布信息
        GitHub-->>Workflow: 返回发布体或错误
        Workflow->>Workflow: 使用默认描述作为备选
    end
    end

    rect rgb(255, 250, 240)
    Note over Uploader: 上传处理阶段
    User->>Uploader: 上传资源(启用进度报告)
    Uploader->>Uploader: 设置请求超时(10 分钟)
    Uploader->>Uploader: 记录开始时间
    Uploader->>Uploader: 监听响应进度(每 1 MB 记录)
    Uploader->>Uploader: 监听套接字连接事件
    alt HTTP 2xx
        Uploader->>Uploader: 计算耗时与速度
        Uploader-->>User: 返回成功(含状态、耗时、速度)
    else 超时
        Uploader->>Uploader: 销毁请求
        Uploader-->>User: 返回超时错误
    else HTTP 非 2xx
        Uploader-->>User: 返回状态码与响应片段
    end
    end
Loading

评估代码审查工作量

🎯 3 (中等) | ⏱️ ~20 分钟

此次变更涉及两个文件的逻辑修改:工作流程中的标签派生与发布体获取逻辑需逐一验证边界情况(标签与分支提取),上传脚本中的超时、进度报告及 HTTP 状态处理涉及多个新的交互点,整体复杂度中等。

可能相关的 PR

🐰 标签从枝条中跃起,
网络包裹如水流淌,
进度条舞动着欢歌,
超时计时有条不紊,
发布如梦般圆满落幕~

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mkdir700/gitcode-upload-timeout

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d88c49 and ee12867.

📒 Files selected for processing (2)
  • .github/workflows/sync-release-to-gitcode.yml (3 hunks)
  • scripts/upload-assets.js (3 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mkdir700 mkdir700 changed the base branch from dev to main October 16, 2025 15:18
@mkdir700 mkdir700 merged commit 6e0a436 into main Oct 16, 2025
4 of 5 checks passed
@mkdir700 mkdir700 deleted the mkdir700/gitcode-upload-timeout branch October 16, 2025 15:18
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.

1 participant