Files
paseo/public-docs/hub/github.zh-CN.md
T
Mohamed Boudra d87998bc8c feat(website): serve paseo.sh in Simplified Chinese
Every page of the website now has a Simplified Chinese version under
/zh-CN: the interface, docs, blog posts, comparison pages, legal pages,
all changelog releases and the homepage mockup. English URLs are unchanged.

The URL alone decides the language. There is no browser-language redirect
and no stored preference, because either would have to redirect the
unprefixed English URLs that people share and search engines index.
Internal links carry the page's language instead, and hreflang alternates
point Chinese search results at /zh-CN.

Translated headings pin the English anchor with {#id}, so section links
work in both languages. content-translations.test.ts fails when a page
has no translation or a translation's headings drift from the English.
Changelog releases and plugin listings without a translation render
whole in English under a notice, so a release never waits on one.

Plugin manifests and the registry gain optional translations and
OVERVIEW.zh-CN.md fields; older clients and registries ignore them.
2026-10-19 08:30:45 +02:00

3.2 KiB

title, description, nav
title description nav
GitHub 访问 为 workflow 中的某个 step 授予限定范围的 GitHub token 和 git 设置。 GitHub 访问

GitHub 访问

触发器不授予任何 GitHub 凭据。请在需要仓库权限的 step 上添加 github 块:

name: implement-request
on: github.issue_comment
max_runtime: 2h
filters:
  repo: example/project
  contains: "@paseo"
  from_users: [maintainer]
steps:
  - id: implement
    environment: development
    max_runtime: 90m
    idle_timeout: 10m
    agent: codex
    github:
      connection: example-github
      repositories: [example/project]
      permissions:
        contents: write
        pull_requests: write
    prompt:
      - text: |
          Implement the request, push a branch, and open a pull request with gh.
          Call hub.finish_execution when done.
          ${{ paseo.prompt }}

Agent 可以在声明的仓库和权限范围内使用 git 和 gh。当请求延续某个 Agent 时 token 的生命周期,见 Agent 延续。

字段

字段 说明
connection 项目的 GitHub 连接 slug。
repositories token 可以访问的仓库。在由 GitHub 触发的运行中,默认是触发它的仓库。其他 Provider 必须填写。
permissions 安装 token 的权限,例如 contents、pull_requests 和 issues。默认为 contents: read。
duration token 的有效期,为正数,最长 1h。默认为 1h,即 GitHub 允许的最大值。

请求的权限不能超过 GitHub App 安装所具有的权限。如果无法解析连接、仓库或权限,激活和派发会明确失败。

Agent 环境

Hub 通过环境变量提供 GH_TOKEN 以及进程级的 git 配置:

  • 提交使用 App 机器人的登录名作为 user.name,使用 <app-id>+<bot-login>@users.noreply.github.com 作为 user.email。
  • git@github.com: 和 ssh://git@github.com/ 远程地址会被改写为 HTTPS。
  • gh auth git-credential 负责处理该 step 的 GitHub 凭据。
  • 用户全局和系统级的 git 配置会被忽略,终端凭据提示会被禁用。
  • 不会读取或修改 daemon 主机的 git 身份和凭据。

当 step 带有 github 块时,GH_TOKEN 和 Hub 的 git 配置变量是保留的;workflow 的 env 不能替换它们。

把权限留给执行者

分类器可以在没有 GitHub 权限的情况下读取不受信任的请求文本。只在之后真正做出改动的分支上添加 github 块。Workflow 路由展示了按顺序排列的分类器/执行者结构。

其他集成的连接值仍然是显式的 step 环境变量值:

env:
  SOME_TOKEN: "${{ paseo.connections.some-connection.token }}"

Hub 在准备 Agent 的环境时解析这个值。Provider 和主机的边界见 Hub 安全。