/ci-build:copilot-cli-github-actionsfrom ci-build
Run GitHub Copilot CLI headlessly inside GitHub Actions (Claude/GPT models billed via Copilot instead of a metered provider API key). Use when: (1) building a workflow or composite action that calls `copilot -p` in CI; (2) deciding between GITHUB_TOKEN and a PAT for Copilot CLI auth in Actions; (3) Copilot CLI in CI fails auth confusingly even though GITHUB_TOKEN is present in the env; (4) the CLI hangs or exits without acting because tool permissions were not pre-approved (missing --allow-tool/--no-ask-user); (5) choosing the flag/env var to select a Claude model in Copilot CLI; (6) installing a Claude Code plugin/skill marketplace into Copilot CLI (copilot plugin marketplace add / plugin install).
Ships in ci-build. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Running an agentic Claude task in CI normally needs an ANTHROPIC_API_KEY
secret with metered billing. Copilot CLI can run the same kind of task under
an existing Copilot subscription, but its CI auth model, non-interactive
flags, and tool-permission syntax are spread across several doc pages and
changed materially in July 2026.
copilot -p "..." on a runnerGITHUB_TOKEN being set (see gotcha below)Install (Node 22+ required):
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm install -g @github/copilot
Auth — two options. Token env-var precedence is
COPILOT_GITHUB_TOKEN > GH_TOKEN > GITHUB_TOKEN.
Built-in GITHUB_TOKEN (no secrets; available since 2026-07-02): declare
the permission in the workflow and it just works — if the org/repo
"Copilot in GitHub Actions" policy is enabled.
permissions:
copilot-requests: write
Fine-grained PAT with the "Copilot Requests" permission, stored as a
secret and exported as COPILOT_GITHUB_TOKEN. Use when the policy is off
or usage should bill a specific user's seat.
Gotcha: Actions always injects GITHUB_TOKEN into the env, and the CLI
will pick it up (lowest precedence) even when it has no Copilot entitlement,
producing a confusing auth error (github/copilot-cli#3396). When using a PAT,
set COPILOT_GITHUB_TOKEN explicitly — it outranks the ambient token.
Programmatic mode: copilot -p "PROMPT" plus pre-approved tools, either
--allow-all-tools (docs: required for programmatic use) or granular allows
with --no-ask-user:
copilot -p "$(cat prompt.md)" \
--allow-tool=read \
--allow-tool=write \
--allow-tool='shell(grep:*),shell(find:*),shell(cat:*),shell(git:*)' \
--deny-tool='shell(git push)' \
--deny-tool='shell(gh:*)' \
--no-ask-user
Patterns are Kind(argument); prefix matching on word boundaries
(shell(git:*) matches git push, not gitea); deny always beats allow,
even under --allow-all.
Model selection: --model=MODEL or COPILOT_MODEL env var.
claude-sonnet-4.6 is the default as of 2026-07; claude-haiku-4.5 for
cheap/fast; auto lets Copilot choose.
Plugins & skills: Copilot CLI plugin marketplaces are format-compatible
with Claude Code plugin marketplaces (the official docs register
anthropics/claude-code as their example). In CI:
copilot plugin marketplace add OWNER/REPO
copilot plugin install PLUGIN@MARKETPLACE-NAME
MARKETPLACE-NAME is the name field in the repo's
.claude-plugin/marketplace.json, not OWNER/REPO. Reference the plugin's
skill by name in the -p prompt afterward. Also: there is no GitHub-owned
setup action for the CLI (marketplace "setup" listings are 1–20 star
community wrappers) — the docs' official install is
npm install -g @github/copilot.
Output pattern: have the agent write its result to a file
($RUNNER_TEMP/report.md), test -s it, and let deterministic shell steps
do the GitHub side effects (gh issue create, $GITHUB_STEP_SUMMARY).
Denying shell(gh:*) to the agent keeps all GitHub mutations in reviewable
bash instead of model-driven calls.
Used to build the ponytail-audit composite action in
custom-github-actions (2026-07-19). Flags/auth verified against the official
docs and changelog the same day; not yet exercised in a live CI run.
.claude/skills/; inline skill
instructions into the prompt.copilot-requests permission
scope and reports unknown permission scope "copilot-requests" — a false
positive; the permission is current per GitHub docs. Expect it locally and
from reviewdog/actionlint CI checks until the schema updates.--allow-tool='shell(*)' with a token in env — allowlist read-only
commands so curl is denied. Use persist-credentials: false on
checkout, or the ambient token lands in .git/config where an
allowlisted cat can read it into model output.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub cajias/claude-skills --plugin ci-build5 skills in this plugin
/cron-block-generation-gotchasGuide for writing or debugging code that programmatically generates cron
blocks (crontab entries). Use when: (1) a cron job runs fine by hand but
silently never fires from cron, (2) writing an `enable`/`install`-style
command that appends entries to a user's crontab, (3) cron jobs referring
to paths under `~/Documents/...` or `~/Library/...` that contain spaces,
(4) cron jobs invoking tools installed to `~/.local/bin`, `~/.cargo/bin`,
`~/go/bin`, or a uv/pipx/npm user-install dir, (5) debugging "works in my
shell, broken from cron" with no error output. Covers the two interacting
gotchas — unquoted-space shell splitting and cron's stripped $PATH — plus
how to reproduce cron's environment locally with `env -i` and how to
generate a correct block with `shlex.quote()` and `shutil.which()`.
/gfootball-docker-apple-siliconBuild and run Google Research Football (gfootball 2.10.2) in Docker on Apple Silicon
(macOS arm64) / Python 3.12, where native pip install fails. Use when: (1) `pip install
gfootball` fails with "Google Research Football compilation failed", (2)
"ModuleNotFoundError: No module named 'psutil'" during gfootball's C++ build,
(3) "ModuleNotFoundError: No module named 'six'" at gfootball import time,
(4) "ValueError: too many values to unpack (expected 2)" on env.reset(),
(5) CMake "Compatibility with CMake < 3.5 has been removed" during the build,
(6) the `cmake` pip package tries to git-clone CMake from github and fails.
Covers the full ubuntu:24.04 Dockerfile recipe + the gym/six runtime pins.
/gha-setup-uv-cache-glob-mismatchFix for GitHub Actions workflows using `astral-sh/setup-uv@v4` (or v5)
failing immediately with `Error: No file matched to [**/uv.lock]` and
cascading to skip every downstream job. Use when:
(1) a GHA workflow shows the first uv-using job as failed and most
others as skipped/cancelled after a push, despite the underlying
steps being correct;
(2) the failing job's log contains literally
`Error: No file matched to [**/uv.lock]` right after
`Run astral-sh/setup-uv@v4`;
(3) the repo's `.gitignore` includes `uv.lock` (common for libraries
that want consumers to resolve their own deps);
(4) running `uv sync` works locally but every uv-using GHA step
blows up before reaching `uv sync`.
Root cause: setup-uv's cache layer defaults
`cache-dependency-glob: **/uv.lock`, requires the glob to MATCH at
least one tracked file, and treats a no-match as a hard failure.
Fix is one line per setup-uv invocation:
`cache-dependency-glob: pyproject.toml`.
/monorepo-cookiecutter-ts-gotchasBugs and footguns when cutting a TypeScript-only instance of the
cajias/monorepo-cookiecutter scaffold and getting its test tiers green. Use
WHENEVER you scaffold, cut, or generate a project from
cajias/monorepo-cookiecutter (especially headless via COOKIECUTTER_SUBPROJECTS
+ uvx cookiecutter --no-input), OR when a freshly-cut instance shows any of:
every Cucumber step "undefined" though steps exist (config is the dotfile
.cucumber.mjs, not auto-discovered); first step fails, this.apiEndpoint
undefined (world.ts never calls setWorldConstructor); node_modules/.env staged,
no .gitignore generated; pnpm install can't resolve @lint-configs/eslint-config
(404 not 403 with a write:packages token; use a file: link); husky/pre-commit
fails on "Type tag typescript is not recognized" (commit --no-verify);
cucumber-js --name won't match or won't load .env; make install fails
frozen-lockfile after a dep add; jest double-runs or finds no tests; tsc errors
on JSX.Element under React 19. Covers all 11 recurring traps.