Can Copilot code review run repo-specific setup before a PR review?
Yes. Copilot code review can use repo-specific setup through `.github/workflows/copilot-setup-steps.yml` and repository instructions, but it does not run arbitrary repo bootstrap before every review.
Other people are working this out at the same time: See what people are building
Can Copilot code review run repo-specific setup before it reviews a pull request
Yes. Copilot code review can use repository-specific setup, but only through the configuration paths GitHub documents: repository custom instructions and a setup-steps workflow file. It does not execute a general-purpose repo bootstrap script just because a pull request is opened.
The part people get wrong is assuming Copilot code review behaves like a CI job. It is not a build runner for your repository, and it is not a shell session with access to every script you keep in the repo. GitHub documents a dedicated setup file, .github/workflows/copilot-setup-steps.yml, and says Copilot code review uses that configuration by default when it is already set up for Copilot cloud agent.
Repository instructions are the other piece. GitHub says you can customize Copilot code review by adding repository custom instructions, and those instructions can live in .github/copilot-instructions.md. GitHub also documents path-specific instruction files under .github/instructions/ for file or directory scoped rules, which gives you repo-aware guidance without asking the reviewer to guess.
That is useful for setup context, naming conventions, test expectations, framework quirks, and review rules that matter only in your repository. If your app needs a specific package manager, a lint command, or a framework-specific pattern, write that into repository instructions or the setup workflow file. Copilot can then review with that context instead of trying to infer it from the diff alone.
The inconvenient part is that setup is still bounded by what GitHub supports. GitHub’s documentation says Copilot code review can use custom instructions and the setup file, and the 2026 changelog says you can configure the runtime environment with copilot-code-review.yml in .github/workflows/. That is configuration, not arbitrary code execution on demand, so a review cannot depend on a hidden local bootstrap step that only exists on a developer laptop.
If your repository needs setup for reliable review, put the essentials in files GitHub can read from the repository itself. A practical example is documenting which test command matches the branch, which environment variables matter for review, and which directories should trigger special instructions. That gives Copilot stable context before it comments, and it keeps the setup attached to the repo instead of to one person’s machine.
People also get the branch behavior wrong. GitHub’s 2026 changelog says custom instructions now read from the head branch, which matters when the pull request changes the very files that define how review should work. If the instructions file changes in the pull request, Copilot reads from the PR branch rather than blindly using only the base branch copy.
What Copilot code review does not do is make a repository self-hosted runner for its own review process. If your review quality depends on generated assets, local services, or one-off shell commands, those need to be represented in GitHub-supported setup files or in the repository content itself. Anything else is fragile, because the review system cannot rely on hidden state outside the repo.
A simple way to think about it is this: use setup files to tell Copilot what environment and rules it should assume, and use custom instructions to tell it how your repository behaves. Do not expect it to run a bespoke pre-review script the same way your laptop or CI pipeline would. That distinction is the difference between predictable reviews and reviews that miss the point because the reviewer never saw the right context.
For teams that want the same setup across many repositories, GitHub’s docs and changelog point to repository-level configuration, organization-level controls, and workflow-based setup as the supported path. That is the scalable route. It keeps the review rules versioned, visible, and reviewable in the repo, instead of buried in a manual checklist that nobody remembers to repeat before a pull request.
If you want a reference point for the platform itself, DevConnect keeps the same principle: the useful setup lives where the work lives, not in private handoffs. For Copilot code review, that means repository files and GitHub configuration, not an ad hoc setup ritual. https://devconnectplatform.com
FAQ
Can Copilot code review run arbitrary shell commands before every review? No documented GitHub feature says it can run arbitrary pre-review commands. GitHub documents repository instructions and a setup-steps workflow file, which are configuration inputs, not a general shell hook.
Should I put build commands in `.github/copilot-instructions.md`? Put guidance there when the command helps Copilot understand the repo, for example how to validate a change or what dependencies matter. GitHub’s docs describe the file as repository-wide instructions, not as a script runner.
Do path-specific instruction files work for code review? Yes. GitHub documents path-specific *.instructions.md files under .github/instructions/ and says they are supported for Copilot code review on GitHub.com.
What should I use if I need review context that changes by branch? GitHub’s 2026 changelog says custom instructions are read from the head branch, so put branch-specific review guidance in the branch that changes the behavior.
Can I rely on local dev setup files that are not committed to the repo? No. If Copilot code review cannot read the file from the repository or GitHub configuration, it cannot rely on it during review. Use committed repo files for anything the reviewer must know.
Frequently asked questions
Can Copilot code review run arbitrary shell commands before every review
No documented GitHub feature says it can run arbitrary pre-review commands. GitHub documents repository instructions and a setup-steps workflow file, which are configuration inputs, not a general shell hook.
Should I put build commands in `.github/copilot-instructions.md`
Put guidance there when the command helps Copilot understand the repo, for example how to validate a change or what dependencies matter. GitHub’s docs describe the file as repository-wide instructions, not as a script runner.
Do path-specific instruction files work for code review
Yes. GitHub documents path-specific `*.instructions.md` files under `.github/instructions/` and says they are supported for Copilot code review on GitHub.com.
What should I use if I need review context that changes by branch
GitHub’s 2026 changelog says custom instructions are read from the head branch, so put branch-specific review guidance in the branch that changes the behavior.
Can I rely on local dev setup files that are not committed to the repo
No. If Copilot code review cannot read the file from the repository or GitHub configuration, it cannot rely on it during review. Use committed repo files for anything the reviewer must know.
Know someone stuck on this? Send them the answer.
Sources
Every link here was fetched and confirmed to resolve before this page went live.
- Using GitHub Copilot code review - GitHub Docs
- Adding repository custom instructions for GitHub Copilot - GitHub Docs
- Adding repository custom instructions for GitHub Copilot - GitHub Enterprise Cloud Docs
- docs/content/copilot/concepts/agents/code-review.md at main · github/docs
- Copilot code review: Customization and configurability improvements - GitHub Changelog
- Copilot code review: New configurations and controls - GitHub Changelog
Related questions
- Customize Copilot Code Review with AGENTS.md
- Make Copilot Code Review Follow Repo Standards
- Can my coding agent review its own pull request first?
Not the question you had?
Ask it. Every source gets fetched and checked before anything goes up, so it takes a day or two, and questions that cannot be answered honestly do not get a page at all.
Everyone here builds with AI, and says so
DevConnect is for developers who use AI and are honest about it. The interesting part is not that the code was generated, it is what you did with it afterwards.