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_dispatchand on pushes and pull requests that touch the file itself (so you can test it), usesubuntu-latest,permissions: contents: read, then leaves the dependency steps to your project. Its separate dependency example uses checkout, Node with npm cache andnpm 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-depthon checkout is overridden so Copilot can roll back commits. Without a checkout step Copilot checks out the code afterwards. Git LFS needslfs: trueon 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