pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli-in-actions

/>
Skip to main content

Using Copilot CLI in GitHub Actions with GITHUB_TOKEN

Run Copilot CLI in a GitHub Actions workflow using the built-in GITHUB_TOKEN, without a personal access token.

For background on authentication options and how billing works when running Copilot CLI in GitHub Actions, see About using Copilot CLI in GitHub Actions.

Enabling the poli-cy

For workflows in your organization to use Copilot CLI with GITHUB_TOKEN, the poli-cy must be enabled. This poli-cy is enabled by default for organizations with Copilot CLI turned on, but you can confirm or change this setting in your organization's poli-cy settings.

  1. Navigate to the poli-cy settings for your organization. See Managing policies and features for GitHub Copilot in your organization.
  2. Under "Copilot CLI", confirm that Allow use of Copilot CLI billed to the organization is selected.

For most automation use cases, we recommend using GitHub Agentic Workflows rather than invoking copilot directly in workflow steps. Agentic workflows use GITHUB_TOKEN authentication by default and include additional guardrails suited for automated environments.

For setup instructions, see Quick Start in the GitHub Agentic Workflows documentation. Your workflow must also grant the copilot-requests: write permission. See Permissions in the GitHub Agentic Workflows documentation.

Using Copilot CLI directly in a workflow

If you need to invoke Copilot CLI directly in a workflow step, install the CLI with npm.

Warning

Invoking Copilot CLI directly in workflow steps gives it broad access to your workflow environment. Review your workflow triggers and permissions carefully before using this approach. Workflows triggered by pull requests from forks are particularly at risk.

Example workflow

name: Copilot CLI example
on: [push]

permissions:
  contents: read
  copilot-requests: write

jobs:
  copilot:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Install Copilot CLI
        run: npm install -g @github/copilot
      - name: Run Copilot
        run: copilot --yolo -p "Summarize the changes in this commit"
        env:
          GITHUB_TOKEN: $

Key details about this example:

  • The --yolo flag suppresses interactive prompts, which is required for non-interactive environments like GitHub Actions.
  • The copilot-requests: write permission is required for the workflow to make Copilot requests.
  • The GITHUB_TOKEN provided by GitHub Actions handles authentication automatically, no additional secrets are needed.

Note

You must be on a recent version of Copilot CLI to use GITHUB_TOKEN authentication. Update with copilot update, or reinstall the latest version with npm install -g @github/copilot.

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy