checkout-credential-review

bởi github

Xem xét mã thực hiện các thao tác git hoặc gh trên các bản sao kho lưu trữ trong gh-aw, kiểm tra xem thông tin xác thực phù hợp có sẵn vào đúng thời điểm hay không và…

npx skills add https://github.com/github/gh-aw --skill checkout-credential-review

Checkout Credential Review

Use this skill when reviewing or writing code in pkg/workflow/, actions/setup/js/, or compiled .lock.yml workflows that runs git, gh, or any other remote-touching operation against a repository checkout.

Background

Each entry in a workflow's checkout: block may declare its own credentials (github-token:, github-app:), and the compiler wires those into the corresponding actions/checkout step (pkg/workflow/checkout_step_generator.go). Generated checkouts always set persist-credentials: false, so the on-disk repo retains no credentials after the step finishes — only actions/checkout's own internal token is used during the clone, and it is scrubbed in its post-step.

A separate step that wants to authenticate later must either (a) re-inject a token at command level (e.g. git -c http.extraheader=...) or (b) be passed the per-checkout token via env. The compiler does not automatically thread per-checkout github-tokens into downstream steps.

Two important contexts deliberately run with no git credentials:

  • The safe-outputs MCP server and its handlers (generate_git_bundle.cjs, generate_git_patch.cjs, create_pull_request.cjs). Errors in these paths explicitly say "the safe-outputs MCP server has no credentials for private repositories" — fetch/push will fail for private repos.
  • The agent runtime after actions/checkout. The agent prompt in actions/setup/md/safe_outputs_push_to_pr_branch.md explicitly tells the model not to attempt git fetch, git pull, git push, or any other authenticated git operation, and to report unavailable branches rather than try to fetch them.

Review checklist

When you see a new git, gh, execFileSync('git'…), or compiled run: block:

  1. Does it touch a remote? Local-only commands (symbolic-ref, rev-parse, log, show, merge-base, diff, status) need no credentials. Anything in fetch | pull | push | clone | ls-remote | remote (set-url|add|update) does, plus on-demand blob fetches in partial clones.
  2. Which checkout is it operating on? If it's a cross-repo entry from checkout:, the relevant credential is that entry's github-token, not the workflow's default GITHUB_TOKEN. Confirm the per-entry token is actually threaded into the step's env (or refuse to do remote operations and degrade gracefully).
  3. Which job/context emits it? Agent job and safe-outputs MCP server both run without git credentials by design. Any remote git operation there must be wrapped in try/catch, fail soft, and surface a clear "no credentials" error rather than a raw git stderr.
  4. Sparse / shallow / monorepo concerns. Avoid emitting steps that deepen (git fetch --unshallow, --deepen=N) or widen (git fetch origin '+refs/heads/*') a sparse or shallow checkout of a large monorepo — these need credentials and can pull hundreds of MB. Prefer expanding fetch: / fetch-depth: / sparse-checkout: at compile time so it happens during actions/checkout with its internal token, never later.
  5. gh is REST, not git. gh api … uses whatever GH_TOKEN is in the step's env — it does not automatically inherit per-checkout PATs. For cross-org private repos, either thread the right token in or accept the call will 404 and handle it.

Related

Thêm skills từ github

debugging-workflows
github
Hướng dẫn gỡ lỗi các quy trình tác nhân GitHub - phân tích nhật ký, kiểm tra lần chạy và khắc phục sự cố
go-codemod
github
Triển khai và kiểm thử các codemod Go cho lệnh gh aw fix.
acreadiness-policy
github
Giúp người dùng chọn, viết hoặc áp dụng chính sách AgentRC. Chính sách tùy chỉnh điểm sẵn sàng bằng cách tắt các kiểm tra không liên quan, ghi đè mức độ tác động/cấp độ, thiết lập…
ai-ready
github
Biến bất kỳ kho lưu trữ nào thành sẵn sàng cho AI — phân tích mã nguồn của bạn và tạo ra AGENTS.md, copilot-instructions.md, quy trình CI, mẫu issue, và nhiều hơn nữa. Khai thác đánh giá PR của bạn…
create-oo-component-documentation
github
Tạo tài liệu toàn diện, chuẩn hóa cho các thành phần hướng đối tượng, tuân theo các phương pháp thực hành tốt nhất trong ngành và tiêu chuẩn tài liệu kiến trúc.
dependabot
github
Dependabot là công cụ quản lý phụ thuộc tích hợp sẵn của GitHub với ba khả năng cốt lõi:
doublecheck
github
Quy trình xác minh ba lớp cho đầu ra AI. Trích xuất các tuyên bố có thể kiểm chứng, tìm nguồn hỗ trợ hoặc mâu thuẫn qua tìm kiếm web, thực hiện đánh giá đối kháng…
foundry-agent-sync
github
Tạo và đồng bộ hóa các tác nhân AI dựa trên prompt trực tiếp trong Azure AI Foundry thông qua REST API, từ một tệp kê khai JSON cục bộ. Không giống như các kỹ năng scaffolding chỉ…