shunk031-github-cgd-identity

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
[!NOTE] After reading this
SKILL.md
, say:
🎨 I read shunk031-github-cgd-identity.
[!NOTE] 阅读此
SKILL.md
后,请说:
🎨 I read shunk031-github-cgd-identity.

CGD Dev Identity

CGD Dev Identity

Overview

概述

Perform git and gh write operations for creative-graphic-design organization repositories as the
creative-graphic-design-dev
machine user (user ID 176740601), not a personal account. A bot-authored PR lets a human account formally review and approve it. Because GitHub does not permit users to approve their own PRs, creating a PR with a personal account would prevent the review flow from working.
以
creative-graphic-design-dev
机器用户(用户 ID 176740601)而非个人账户,执行 creative-graphic-design 组织仓库的 git 和 gh 写操作。由 bot 创建的 PR 可让人类账户正式进行 review 和 approve。由于 GitHub 不允许用户 approve 自己创建的 PR,因此使用个人账户创建 PR 会导致 review 流程无法正常进行。

Setup

设置

Before starting write operations, perform the following checks in the working shell and worktree. Run them as a starting procedure rather than investigating only after a failure.
  1. For repository writes, confirm that
    git remote get-url origin
    points to
    github.com/creative-graphic-design
    .
    If it does not, this skill does not apply; use normal git identity and authentication. New-machine
    setup-gh-cgd
    bootstrap is exempt.
  2. Ensure that GitHub CLI has the bot account in its system credential store. On a new machine, run the interactive setup command once and authenticate in the browser as
    creative-graphic-design-dev
    :
    bash
    setup-gh-cgd
    Do not use
    gh auth switch
    during agent work. It changes the active account for the whole host and can race with concurrent sessions.
  3. Retrieve the stored bot token by account name and pass it only to each write command that uses gh or git credentials:
    bash
    GH_TOKEN="$(gh auth token --hostname github.com --user creative-graphic-design-dev)" gh pr create ...
    GH_TOKEN="$(gh auth token --hostname github.com --user creative-graphic-design-dev)" git push
    Do not export the token into a persistent shell and do not print it. The per-command prefix keeps account selection explicit and avoids changing GitHub CLI's global active account.
  4. Verify the GitHub identity and push permission for the organization repository.
    gh api user
    only confirms the logged-in account and cannot verify access to organization resources:
    bash
    GH_TOKEN="$(gh auth token --hostname github.com --user creative-graphic-design-dev)" gh api user --jq .login
    GH_TOKEN="$(gh auth token --hostname github.com --user creative-graphic-design-dev)" gh api repos/creative-graphic-design/<repo> --jq .permissions.push
    Do not start write operations unless the first command returns
    creative-graphic-design-dev
    and the second returns
    true
    .
  5. Set the commit author to the bot for each commit command:
    bash
    git -c user.name=creative-graphic-design-dev \
        -c user.email=176740601+creative-graphic-design-dev@users.noreply.github.com \
        commit ...
    Do not use
    git config user.name/email
    in a linked worktree: it writes to the shared
    .git/config
    and changes the author for the main checkout and concurrent worktrees as well.
  6. Push over HTTPS because SSH does not use the proxy in this environment. Set an explicit push URL:
    bash
    git remote set-url --push origin https://github.com/creative-graphic-design/<repo>
GH_TOKEN
applies to both gh and the git credential helper in the same command environment. The credential helper returns the token with the username
x-access-token
.
在开始写操作前,请在当前 shell 和 worktree 中执行以下检查。应将其作为启动流程执行,而不是只在失败后再调查。
  1. 对于仓库写操作,确认
    git remote get-url origin
    指向
    github.com/creative-graphic-design
    。
    如果不符合,则此 skill 不适用;请使用常规 git identity 和 authentication。新机器上的
    setup-gh-cgd
    bootstrap 不受此限制。
  2. 确保 GitHub CLI 的 system credential store 中已配置 bot account。在新机器上,运行一次交互式 setup 命令,并在浏览器中以
    creative-graphic-design-dev
    身份完成 authentication:
    bash
    setup-gh-cgd
    Agent 工作期间不要使用
    gh auth switch
    。该命令会更改整台主机的活动账户,可能与并发 session 发生冲突。
  3. 按账户名获取已存储的 bot token,并且仅将其传递给各个使用 gh 或 git credentials 的写命令:
    bash
    GH_TOKEN="$(gh auth token --hostname github.com --user creative-graphic-design-dev)" gh pr create ...
    GH_TOKEN="$(gh auth token --hostname github.com --user creative-graphic-design-dev)" git push
    不要将 token export 到持久化 shell 中,也不要打印它。按命令添加前缀可以明确指定账户,同时避免更改 GitHub CLI 的全局活动账户。
  4. 验证 GitHub identity 以及组织仓库的 push permission。
    gh api user
    只能确认当前登录的账户,无法验证对组织资源的访问权限:
    bash
    GH_TOKEN="$(gh auth token --hostname github.com --user creative-graphic-design-dev)" gh api user --jq .login
    GH_TOKEN="$(gh auth token --hostname github.com --user creative-graphic-design-dev)" gh api repos/creative-graphic-design/<repo> --jq .permissions.push
    除非第一个命令返回
    creative-graphic-design-dev
    且第二个命令返回
    true
    ,否则不要开始写操作。
  5. 对每个 commit 命令,将 commit author 设置为 bot:
    bash
    git -c user.name=creative-graphic-design-dev \
        -c user.email=176740601+creative-graphic-design-dev@users.noreply.github.com \
        commit ...
    不要在 linked worktree 中使用
    git config user.name/email
    。该操作会写入共享的
    .git/config
    ,同时更改主 checkout 和并发 worktree 的 author。
  6. 通过 HTTPS 执行 push,因为此环境中的 SSH 不会使用 proxy。请设置明确的 push URL:
    bash
    git remote set-url --push origin https://github.com/creative-graphic-design/<repo>
在同一个命令环境中,
GH_TOKEN
同时适用于 gh 和 git credential helper。Credential helper 返回的 token 使用用户名
x-access-token
。

Scope

适用范围

  • This skill applies only to creative-graphic-design organization repositories on github.com. Do not use the stored bot credential or the bot commit identity for other hosts, organizations, or personal repositories; use normal authentication and the normal git identity there.
  • Attribute every coding-agent write to a creative-graphic-design organization repository to the bot. This includes commits, pushes, PR creation and updates, PR replies, issue comments, labels, milestones, and user-requested merges.
  • If any Setup verification fails, abandon the bot identity entirely: do not apply it partially, such as setting the bot commit author while the credential check failed or pushing through another account. Stop and report instead.
  • The human (
    shunk031
    ) retains only PR approval in the GitHub UI and the decision to merge. Do not approve PRs as the bot.
  • 此 skill 仅适用于 github.com 上的 creative-graphic-design 组织仓库。不要在其他主机、组织或个人仓库中使用已存储的 bot credential 或 bot commit identity;在这些场景下应使用常规 authentication 和常规 git identity。
  • 对 creative-graphic-design 组织仓库的所有 coding-agent 写操作,都必须使用 bot identity。这包括 commit、push、PR 创建与更新、PR 回复、issue 评论、label、milestone 以及用户请求的 merge。
  • 如果任何 Setup 验证失败,请完全放弃 bot identity:不要局部应用该身份,例如在 credential 检查失败时仍设置 bot commit author,或通过其他账户执行 push。请停止操作并报告问题。
  • 人类用户(
    shunk031
    )仅负责在 GitHub UI 中 approve PR,以及决定是否 merge。不要以 bot 身份 approve PR。

Troubleshooting

故障排查

  • If
    gh auth token --user creative-graphic-design-dev
    fails or the stored credential is rejected, remove that account with
    gh auth logout --hostname github.com --user creative-graphic-design-dev
    , then rerun
    setup-gh-cgd
    . This changes local authentication state and must be done interactively by the user.
  • If the identity check succeeds but repository permission is
    false
    , grant
    creative-graphic-design-dev
    access to the target repository before retrying. Reauthentication is unnecessary when only repository membership changes.
  • 如果
    gh auth token --user creative-graphic-design-dev
    执行失败,或已存储的 credential 被拒绝,请使用
    gh auth logout --hostname github.com --user creative-graphic-design-dev
    移除该账户,然后重新运行
    setup-gh-cgd
    。此操作会更改本地 authentication 状态,必须由用户以交互方式完成。
  • 如果 identity 检查成功,但仓库 permission 为
    false
    ,请先授予
    creative-graphic-design-dev
    对目标仓库的访问权限,然后重试。如果仅更改了仓库 membership,则无需重新 authentication。