Skip to content

NetFabric/NetFabric.Numerics / .agents/skills/copilot-github-actions

copilot-github-actions

Verified

Automate GitHub Copilot CLI in GitHub Actions workflows. USE FOR: installing/running `copilot -p` in workflow steps, choosing GITHUB_TOKEN vs a personal access token (COPILOT_GITHUB_TOKEN) for authentication, setting the copilot-requests write permission, minimal-permission tool allowlisting (--allow-tool, --deny-tool, --no-ask-user, -s/--silent, --output-format=json), triggers (schedule, workflow_dispatch, push), the recommended GitHub Agentic Workflows (gh-aw) alternative to direct CLI invocation, and security/cost considerations (fork PR prompt-injection risk, billing attribution, cost centers). DO NOT USE FOR: embedding the Copilot agent runtime into your own application (use copilot-sdk instead); general GitHub Actions authoring unrelated to Copilot; the Copilot code review or PR features outside of CLI automation.

references/authentication.md

View on GitHub
# Authentication

## Two options

| Method | How it works | Best for |
|---|---|---|
| `GITHUB_TOKEN` | Built-in Actions token; no secrets to create/rotate | Org-owned repos; recommended for automation at scale |
| Personal access token (PAT) | Fine-grained PAT with "Copilot Requests" permission, stored as a secret | Repos without the org policy enabled, or billing to a specific user's seat |

## Using `GITHUB_TOKEN`

Requires the org policy **"Allow use of Copilot CLI billed to the organization"** (enabled by default for orgs with Copilot CLI turned on — verify under org Copilot policy settings). Grant the workflow permission and pass the token as an env var:

```yaml
permissions:
  contents: read
  copilot-requests: write
jobs:
  copilot:
    steps:
      - run: npm install -g @github/copilot
      - run: copilot --allow-all -p "Summarize the changes in this commit"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

`--allow-all`/`--yolo` (or targeted `--allow-tool` flags) is required since there's no user to answer interactive prompts. Requires a recent CLI version — update with `copilot update` or reinstall via npm.

## Using a PAT (`COPILOT_GITHUB_TOKEN`)

1. Create a fine-grained PAT at `github.com/settings/personal-access-tokens/new` with the **Copilot Requests** account permission (classic `ghp_` tokens are not supported).
2. Store it as an Actions repository secret (Settings → Secrets and variables → Actions), e.g. named `PERSONAL_ACCESS_TOKEN`.
3. Pass it as `COPILOT_GITHUB_TOKEN` so it doesn't collide with any `GITHUB_TOKEN` usage elsewhere in the workflow:

```yaml
- name: Run Copilot CLI
  env:
    COPILOT_GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
  run: copilot -p "..." --allow-tool='shell(git:*)' --allow-tool=write --no-ask-user
```

## Token precedence

`copilot login` checks environment-variable tokens in this order when no interactive login has been done: `COPILOT_GITHUB_TOKEN` → `GH_TOKEN` → `GITHUB_TOKEN`. Supported token types: fine-grained PATs (v2) with Copilot Requests, OAuth tokens from the Copilot CLI app, OAuth tokens from `gh`. Classic PATs are not supported.

## Billing

* PAT: AI credits draw from the token owner's Copilot seat; their license determines available models/features. Works in any repo, but ties usage to one person.
* `GITHUB_TOKEN` in a personally-owned repo: billed to that owner's seat.
* `GITHUB_TOKEN` in an org-owned repo: metered directly to the organization (requires the org policy above) — no individual user attribution, so per-user Copilot budgets don't apply. Use cost centers and org billing dashboards to track/limit this spend instead.

## GitHub Enterprise Cloud with data residency

Use `copilot login --host https://example.ghe.com` (or the equivalent host config) when authenticating against a data-residency GHE Cloud instance instead of `github.com`.
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 469kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 469kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 469kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall