-
Notifications
You must be signed in to change notification settings - Fork 59
feat: set up Copilot agent environment with uv, pre-commit, and GitHub Actions workflow #536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please follow https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment to set up .github/workflows/copilot-setup-steps.yml
.
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.
Note
The copilot-setup-steps.yml workflow won't trigger unless it's present on your main branch.
Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Created Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please refer to the following example to revise the workflow.
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@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install JavaScript dependencies
run: npm ci
…oper triggers and permissions Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Revised the workflow following the provided example. Key changes:
Commit: 9c97dc8 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #536 +/- ##
==========================================
- Coverage 60.33% 60.25% -0.08%
==========================================
Files 39 39
Lines 3890 3890
==========================================
- Hits 2347 2344 -3
- Misses 1543 1546 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
This PR sets up the Copilot agent environment following GitHub's official documentation to improve the development experience for AI-assisted coding.
Changes Made
Copilot Setup Workflow:
.github/workflows/copilot-setup-steps.yml
following GitHub's official documentation and example structurecontents: read
) as recommended by GitHubEnvironment Setup:
uv
for Python environment and dependency management (faster than pip)uv tool install
for development tools (pre-commit
,pyright
)pre-commit
as the preferred tool for code quality checksUpdated Copilot Instructions:
.github/copilot-instructions.md
to preferpre-commit run --all-files
over directruff
usageConfiguration Fixes:
pyproject.toml
to use modern ruff configuration format ([tool.ruff.lint]
)ignore-init-module-imports
optionBenefits
uv
package managerThe copilot-setup-steps.yml workflow ensures that Copilot agents have a deterministic, fast, and reliable environment setup instead of relying on trial-and-error dependency discovery.
Fixes #535.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.