Skip to content

Commit 575a642

Browse files
messenseCopilot
authored andcommitted
Add copilot setup steps to customize copilot agent environment
1 parent e518caa commit 575a642

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

.github/copilot-instructions.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
### Required Before Each Commit
44

5-
- Run `cargo clippy` to ensure the code builds successfully and address any warnings.
5+
- Run `cargo clippy --tests --all-features -- -D warnings` to ensure the code builds successfully and address any warnings.
66
- Run `cargo fmt` to ensure the code is formatted correctly.
77
- Run `cargo test` to ensure all tests pass.
8+
- Run `pre-commit` to ensure code quality and consistency.
89

910
## Key Guidelines
1011

1112
- Follow Rust best practices and idiomatic patterns.
12-
- Maintain existing code structure and organization unless it's necessary to refactor.
13+
- Maintain existing code structure and organization by default unless instructed to refactor or refactoring can improve maintainability or performance.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
jobs:
15+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
16+
copilot-setup-steps:
17+
runs-on: ubuntu-latest
18+
19+
# Set the permissions to the lowest permissions possible needed for your steps.
20+
# Copilot will be given its own token for its operations.
21+
permissions:
22+
# 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.
23+
contents: read
24+
25+
# You can define any steps you want, and they will run before the agent starts.
26+
# If you do not check out your code, Copilot will do this for you.
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
- uses: astral-sh/setup-uv@v6
31+
- run: uv tool install pre-commit
32+
- uses: actions/cache@v4
33+
with:
34+
path: ~/.cache/pre-commit
35+
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
36+
- run: pre-commit install-hooks

0 commit comments

Comments
 (0)