Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

The Copilot Coding Agent's ephemeral environment lacked the multi-language toolchain and dependencies required by this SDK repository, forcing the agent to discover and install them through trial and error during each session.

Changes

Updated .github/workflows/copilot-setup-steps.yml to pre-configure the agent environment:

  • Language runtimes: Node.js 22, Python 3.12 + uv, Go 1.23, .NET 8.0
  • Build tools: just command runner, gh-aw extension
  • Dependency installation: All SDK dependencies (npm, uv, go mod, dotnet) and test harness
  • Caching: npm and uv caching enabled for faster subsequent runs

The configuration mirrors the devcontainer.json and aligns with existing CI/CD workflows.

Original prompt

Here's the documentation to customize the Copilot Coding Agent environment for a repo, you need to do this to match the devcontainer.json as much as possible:

# Customizing the development environment for GitHub Copilot coding agent

Learn how to customize GitHub Copilot's development environment with additional tools.

## About customizing Copilot coding agent's development environment

While working on a task, Copilot has access to its own ephemeral development environment, powered by GitHub Actions, where it can explore your code, make changes, execute automated tests and linters and more.

You can customize Copilot's environment to:

* [Preinstall tools or dependencies in Copilot's environment](#preinstalling-tools-or-dependencies-in-copilots-environment)
* [Set environment variables in Copilot's environment](#setting-environment-variables-in-copilots-environment)
* [Upgrade from standard GitHub-hosted GitHub Actions runners to larger runners](#upgrading-to-larger-github-hosted-github-actions-runners)
* [Run on your ARC-based GitHub Actions self-hosted runners](#using-self-hosted-github-actions-runners-with-arc)
* [Enable Git Large File Storage (LFS)](#enabling-git-large-file-storage-lfs)
* [Disable or customize the agent's firewall](/en/copilot/customizing-copilot/customizing-or-disabling-the-firewall-for-copilot-coding-agent).

## Preinstalling tools or dependencies in Copilot's environment

In its ephemeral development environment, Copilot can build or compile your project and run automated tests, linters and other tools. To do this, it will need to install your project's dependencies.

Copilot can discover and install these dependencies itself via a process of trial and error, but this can be slow and unreliable, given the non-deterministic nature of large language models (LLMs), and in some cases, it may be completely unable to download these dependencies—for example, if they are private.

Instead, you can preconfigure Copilot's environment before the agent starts by creating a special GitHub Actions workflow file, located at `.github/workflows/copilot-setup-steps.yml` within your repository.

A `copilot-setup-steps.yml` file looks like a normal GitHub Actions workflow file, but must contain a single `copilot-setup-steps` job. This job will be executed in GitHub Actions before Copilot starts working. For more information on GitHub Actions workflow files, see [Workflow syntax for GitHub Actions](/en/actions/using-workflows/workflow-syntax-for-github-actions).

> \[!NOTE]
> The `copilot-setup-steps.yml` workflow won't trigger unless it's present on your default branch.

Here is a simple example of a `copilot-setup-steps.yml` file for a TypeScript project that clones the project, installs Node.js and downloads and caches the project's dependencies. You should customize this to fit your own project's language(s) and dependencies:

```yaml copy
name: "Copilot Setup Steps"

# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab
on:
  workflow_dispatch:
  push:
    paths:
      - .github/workflows/copilot-setup-steps.yml
  pull_request:
    paths:
      - .github/workflows/copilot-setup-steps.yml

jobs:
  # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
  copilot-setup-steps:
    runs-on: ubuntu-latest

    # Set the permissions to the lowest permissions possible needed for your steps.
    # Copilot will be given its own token for its operations.
    permissions:
      # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
      contents: read

    # You can define any steps you want, and they will run before the agent starts.
    # If you do not check out your code, Copilot will do this for you.
    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20"
          cache: "npm"

      - name: Install JavaScript dependencies
        run: npm ci

In your copilot-setup-steps.yml file, you can only customize the following settings of the copilot-setup-steps job. If you try to customize other settings, your changes will be ignored.

  • steps (see above)
  • permissions (see above)
  • runs-on (see below)
  • services
  • snapshot
  • timeout-minutes (maximum value: 59)

For more information on these options, see Workflow syntax for GitHub Actions.

Any value that is set for the fetch-depth option of the actions/checkout action will be overridden to allow the agent to rollback commits upon request, while mitigating security risks. For more informati...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Copilot AI changed the title [WIP] Customize Copilot Coding Agent development environment Configure Copilot agent environment to match devcontainer Jan 27, 2026
Copilot AI requested a review from friggeri January 27, 2026 19:08
@friggeri friggeri marked this pull request as ready for review January 27, 2026 19:55
@friggeri friggeri requested a review from a team as a code owner January 27, 2026 19:55
Copilot AI review requested due to automatic review settings January 27, 2026 19:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Copilot Coding Agent’s pre-run GitHub Actions setup workflow to provision the repo’s multi-language toolchain and install SDK dependencies up front, aligning the agent environment more closely with the devcontainer and existing CI workflows.

Changes:

  • Adds PR trigger and expands copilot-setup-steps to install Node, Python+uv, Go, and .NET toolchains.
  • Installs additional tooling (just, gh-aw) and pre-installs dependencies across SDKs and test harness.
  • Enables npm caching (and uv caching via setup-uv) and adds a verification step for installed tools.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

friggeri and others added 2 commits January 27, 2026 12:59
@friggeri friggeri enabled auto-merge January 27, 2026 20:26
@AlphaHyperGiant
Copy link

AlphaHyperGiant commented Jan 27, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants