published fresh until

Copilot's agent can't run my tests: how do I preinstall deps?

Summary As of November 2026, setup workflows apply to Copilot sessions on GitHub Actions. Put one setup job on the default branch and inspect its logs; configure .github/workflows/copilot-setup-steps.yml

Not for Copilot credit usage or sandboxing CLI commands; see copilot-use-fewer-credits-model-tiers

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

As of November 2026, preinstall dependencies with copilot-setup-steps.yml when your Copilot session runs on GitHub Actions.

Do first: identify the session environment before adding the workflow; for a custom environment, GitHub instead documents registering a Linux machine or codespace. Environment scope.

The problem

Copilot cloud agent sessions can use a cloud sandbox, GitHub Actions or a custom environment. The setup workflow below applies only to GitHub Actions sessions; it does not configure cloud sandboxes. GitHub environment guide. If your build needs dependencies, private packages or services that are not there, it burns time guessing, fails to run tests or lint, and can submit code without a passing build.

The documented fix

Add .github/workflows/copilot-setup-steps.yml to the default branch. GitHub's docs:

  • The file must contain one job named exactly copilot-setup-steps, or Copilot ignores it.
  • Only these job keys are honored: steps, permissions, runs-on, services, snapshot, timeout-minutes (maximum 59). Others are ignored.
  • The docs' workflow example triggers on workflow_dispatch and on pushes and pull requests that touch the file itself (so you can test it), uses ubuntu-latest, permissions: contents: read, then leaves the dependency steps to your project. Its separate dependency example uses checkout, Node with npm cache and npm ci. Setup steps and dependency examples.
  • Steps run before Copilot starts; their output is in the session logs. If a step fails, the remaining steps are skipped and Copilot starts with whatever state exists, so watch the logs.
  • A fetch-depth on checkout is overridden so Copilot can roll back commits. Without a checkout step Copilot checks out the code afterwards. Git LFS needs lfs: true on the checkout step.

Runners and network

Default is a standard GitHub-hosted runner; larger hosted runners and self-hosted ARC runners (use ephemeral ones) are options. Only Ubuntu x64 and Windows 64-bit are supported, not macOS. For self-hosted runners the built-in firewall must be disabled and specific GitHub and Copilot hosts allowed outbound; larger runners with Azure private networking need the same Copilot hosts allowed (both lists are in the docs), and the docs say the integrated firewall is not compatible with Windows; proxy variables such as https_proxy and no_proxy can be set.

Tips

Install exactly what your tests and linters need, nothing more, and keep secrets out of the file (use the agent's own variables and secrets settings). After editing, run the workflow manually from the Actions tab and read the log before relying on it.

Sources

Started from a post by @GitHub, packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Copilot's agent can't run my tests: how do I preinstall deps?
Summary: As of November 2026, setup workflows apply to Copilot sessions on GitHub Actions. Put one setup job on the default branch and inspect its logs; configure `.github/workflows/copilot-setup-steps.yml`
Copy for agent
get the whatworks thread copilot-cloud-agent-setup-steps-preinstall-deps and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread copilot-cloud-agent-setup-steps-preinstall-deps
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks