# GitHub Copilot CLI

> **About this page**
>
> - Task definition: `swaleio/copilot-cli`
> - Summary: Runs GitHub Copilot CLI once, unattended, on a directory, and returns its final answer.
> - Category: Coding assistants
> - Latest version: 1.0.119, published 2026-12-03
> - Page: https://hub.swale.io/swaleio/copilot-cli
> - Versions: https://hub.swale.io/swaleio/copilot-cli/versions, where each version's page has a Markdown copy at its address with `.md` added
> - Index of Swale Hub: https://hub.swale.io/llms.txt
>
> The YAML block below is the task definition's frontmatter, which declares its inputs, outputs and container, and its readme follows. Both are the text of the account that published this task definition, not Swale's.

```yaml
name: GitHub Copilot CLI
description: Runs GitHub Copilot CLI once, unattended, on a directory, and returns its final answer.
category: coding-assistants
inputs:
  prompt:
    description: The instructions for the agent.
    required: true
  directory:
    description: Absolute path of the directory the agent works in, such as a repository an earlier task cloned (e.g. ${{env.WORKFLOW_STORAGE}}/repo).
    required: true
  model:
    description: The model as GitHub Copilot names it, such as claude-sonnet-5.5 or gpt-6.2-sol. With base_url, the name that server gives the model.
    required: true
  github_token:
    description: A GitHub token of your own account with the Copilot Requests permission (pass a secret). Usage counts against that account's Copilot plan.
    default: ""
  base_url:
    description: A server that speaks OpenAI's chat completions API, used instead of GitHub Copilot, such as a model an earlier task serves. With it, the task never contacts GitHub.
    default: ""
  api_key:
    description: The key for base_url's server (pass a secret). Used only with base_url.
    default: ""
  permission:
    description: What the agent may do with nobody there to approve it (read, edit or full). See Permissions.
    default: edit
  result_path:
    description: Path of a file to also write the final answer to. Empty writes none.
    default: ""
  max_minutes:
    description: Minutes after which the run stops and the task fails.
    default: "60"
outputs:
  result:
    description: The agent's final answer, as a JSON string.
exec:
  # docker.io/swaleio/copilot-cli:1.0.119
  image: docker.io/swaleio/copilot-cli@sha256:840083df95244dbd7520b651d84f8a59b2c07dde3d060ee0b82d9bd28c0c8c8e
  args: []
```

# GitHub Copilot CLI

Runs [GitHub Copilot
CLI](https://docs.github.com/en/copilot/how-tos/copilot-cli), once and
unattended in `directory`, with the instructions in `prompt`. Its final answer
becomes the `result` output, and a file at `result_path` when you give one. The
image's entrypoint is the wrapper, so there are no `args`: every setting is an
input.

GitHub Copilot CLI is a product of GitHub. This task definition is built by
Swale; GitHub does not build, endorse or support it. The agent's answers and
changes can be wrong: review them before you rely on them.

## Inputs

| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `prompt` | yes | — | The instructions for the agent. |
| `directory` | yes | — | Absolute path the agent works in, such as a repository an earlier task cloned (e.g. `${{env.WORKFLOW_STORAGE}}/repo`). |
| `model` | yes | — | The model as GitHub Copilot names it, such as `claude-sonnet-5.5` or `gpt-6.2-sol`. With `base_url`, the name that server gives the model. |
| `github_token` | no | — | A GitHub token of your own account with the Copilot Requests permission (pass a secret). |
| `base_url` | no | GitHub Copilot | A server that speaks OpenAI's chat completions API, used instead of GitHub Copilot. |
| `api_key` | no | — | The key for `base_url`'s server (pass a secret). Used only with `base_url`. |
| `permission` | no | `edit` | `read`, `edit` or `full`. See [Permissions](#permissions). |
| `result_path` | no | — | Path of a file to also write the final answer to. |
| `max_minutes` | no | `60` | Minutes after which the run stops and the task fails. |

## Outputs

| Output | Description |
|--------|-------------|
| `result` | The agent's final answer, as a JSON string. Read it with `fromJSON(tasks.<id>.outputs.result)`. |

## Permissions

Nobody is there to approve what the agent wants to do, so `permission` says up
front what it may do. Anything else it asks for is refused.

| `permission` | What the agent can do |
|--------------|-----------------------|
| `read` | Read files, and run only the commands Copilot recognizes as read-only. |
| `edit` | Also edit files. |
| `full` | Everything Copilot can do, any command, path or URL included, with no approval. |

## Signing in

Sign in with a fine-grained token of your own GitHub account that has the
Copilot Requests permission. Usage counts against that account's Copilot plan,
under GitHub's terms. With `base_url`, GitHub Copilot is not used and no GitHub
token is needed. The agent sends your prompt and what it reads to GitHub
Copilot, or to `base_url`'s server, under your own account there.

## Security

The task holds only what the workflow passes it. The agent acts on everything it
reads, though: the files in `directory`, the pages and command output it sees,
and the repository's own instruction files (`AGENTS.md`,
`.github/copilot-instructions.md`). An instruction planted in any of them can
steer it. With `full`, that can mean a command that sends your key or your code
somewhere else. Give it the lowest level the job needs, run it on repositories
you trust, and put a spending limit on the key.

## Compute

**CPU.** The model runs at the provider or at `base_url`; this task only runs the agent, so a GPU compute type wastes money.

## Example

```yaml
name: GitHub Copilot CLI example
compute_type: cpu-4
entry_point: main

blocks:
  main:
    tasks:
      checkout:
        name: Checkout
        uses: swaleio/git-clone
        args:
          repository_url: https://github.com/acme/app.git
          dest: ${{env.WORKFLOW_STORAGE}}/repo
      review:
        name: Review the code
        uses: swaleio/copilot-cli
        start_on:
          - checkout
        args:
          prompt: Review this repository for bugs. List each one with its file and line.
          directory: ${{env.WORKFLOW_STORAGE}}/repo
          model: claude-sonnet-5.5
          github_token: ${{secrets.copilot_token}}
          permission: read
          result_path: ${{env.WORKFLOW_STORAGE}}/review.md
```

The review is in `${{env.WORKFLOW_STORAGE}}/review.md` for later tasks, and in
`${{tasks.review.outputs.result}}`.

---

For the workflow syntax these examples use, see the
[workflow definition reference](https://docs.swale.io/reference/workflow-definition-syntax)
in the [Swale documentation](https://docs.swale.io).

Licensed under the [MIT License](https://github.com/swaleio/task-definitions/blob/main/LICENSE).
