Skip to content

Commit 36908d8

Browse files
committed
ci(copilot): add copilot-setup-steps workflow (#1697)
- Add .github/workflows/copilot-setup-steps.yml: prepares Copilot cloud agent environment before it starts working on any task - Triggers on workflow_dispatch, push and pull_request (scoped to file) - Steps: checkout (v6), stable Rust toolchain, rust-cache, cargo build, install linter, install cargo-machete, install git hooks, linter all - Update docs/issues/1697-ai-agent-configuration.md: mark Task 5 complete
1 parent 60dc5f5 commit 36908d8

2 files changed

Lines changed: 59 additions & 9 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy
4+
# validation, and 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
16+
# by Copilot.
17+
copilot-setup-steps:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
21+
# Set the permissions to the lowest permissions possible needed for your
22+
# steps. Copilot will be given its own token for its operations.
23+
permissions:
24+
contents: read
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v6
29+
30+
- name: Set up Rust toolchain
31+
uses: dtolnay/rust-toolchain@stable
32+
33+
- name: Enable Rust cache
34+
uses: Swatinem/rust-cache@v2
35+
36+
- name: Build workspace
37+
run: cargo build --workspace
38+
39+
- name: Install linter
40+
run: cargo install --locked --git https://github.com/torrust/torrust-linting --bin linter
41+
42+
- name: Install cargo-machete
43+
run: cargo install cargo-machete
44+
45+
- name: Install Git pre-commit hooks
46+
run: ./scripts/install-git-hooks.sh
47+
48+
- name: Smoke-check — run all linters
49+
run: linter all

docs/issues/1697-ai-agent-configuration.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,20 @@ https://raw.githubusercontent.com/torrust/torrust-tracker-deployer/refs/heads/ma
264264

265265
Minimum steps to include:
266266

267-
- [ ] Trigger on `workflow_dispatch`, `push` and `pull_request` (scoped to the workflow file path)
268-
- [ ] `copilot-setup-steps` job on `ubuntu-latest`, `timeout-minutes: 30`, `permissions: contents: read`
269-
- [ ] `actions/checkout@v5` — check out the repository (verify this is still the latest stable
267+
- [x] Trigger on `workflow_dispatch`, `push` and `pull_request` (scoped to the workflow file path)
268+
- [x] `copilot-setup-steps` job on `ubuntu-latest`, `timeout-minutes: 30`, `permissions: contents: read`
269+
- [x] `actions/checkout@v6` — check out the repository (verify this is still the latest stable
270270
version on the GitHub Marketplace before merging)
271-
- [ ] `dtolnay/rust-toolchain@stable` — install the stable Rust toolchain (pin MSRV if needed)
272-
- [ ] `Swatinem/rust-cache@v2` — cache `target/` and `~/.cargo` between runs
273-
- [ ] `cargo build` warm-up — build the workspace (or key packages) so incremental compilation is
271+
- [x] `dtolnay/rust-toolchain@stable` — install the stable Rust toolchain (pin MSRV if needed)
272+
- [x] `Swatinem/rust-cache@v2` — cache `target/` and `~/.cargo` between runs
273+
- [x] `cargo build` warm-up — build the workspace (or key packages) so incremental compilation is
274274
ready when Copilot starts editing
275-
- [ ] Install the `linter` binary —
275+
- [x] Install the `linter` binary —
276276
`cargo install --locked --git https://github.com/torrust/torrust-linting --bin linter`
277-
- [ ] Install `cargo-machete``cargo install cargo-machete`; ensures Copilot can run unused
277+
- [x] Install `cargo-machete``cargo install cargo-machete`; ensures Copilot can run unused
278278
dependency checks (`cargo machete`) as required by the essential rules
279-
- [ ] Smoke-check: run `linter all` to confirm the environment is healthy before Copilot begins
279+
- [x] Smoke-check: run `linter all` to confirm the environment is healthy before Copilot begins
280+
- [x] Install Git pre-commit hooks — `./scripts/install-git-hooks.sh`
280281

281282
Commit message: `ci(copilot): add copilot-setup-steps workflow`
282283

0 commit comments

Comments
 (0)