Skip to content

Commit 7a78c5b

Browse files
committed
Add .github/workflows/copilot-setup-steps.yml
This workflow's primary purpose is to give the Copilot coding agent access to the private microsoft/duroxide-pg-opt repository via a token and a git URL rewrite. It also: - checks out the repo - installs a Rust toolchain - configures Cargo to use git CLI (git-fetch-with-cli = true) - runs cargo fetch to warm caches and validate duroxide-pg-opt access
1 parent 34d379f commit 7a78c5b

1 file changed

Lines changed: 49 additions & 0 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+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
jobs:
13+
copilot-setup-steps:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 59
16+
environment: copilot
17+
18+
# Least privilege; checkout needs contents:read.
19+
permissions:
20+
contents: read
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v5
25+
26+
- name: Install Rust toolchain (stable)
27+
uses: dtolnay/rust-toolchain@stable
28+
29+
# Strongly recommended for private git deps + auth in CI-like envs
30+
- name: Configure Cargo to use git CLI
31+
run: |
32+
mkdir -p ~/.cargo
33+
cat >> ~/.cargo/config.toml << 'EOF'
34+
[net]
35+
git-fetch-with-cli = true
36+
EOF
37+
38+
# Provide non-interactive auth for *all* https://github.com/* git fetches
39+
# using an environment secret in the `copilot` environment.
40+
- name: Configure git auth for private GitHub deps (PAT)
41+
run: |
42+
test -n "${{ secrets.DUROXIDE_PG_OPT_TOKEN }}"
43+
git config --global --add url."https://x-access-token:${{ secrets.DUROXIDE_PG_OPT_TOKEN }}@github.com/".insteadOf "https://github.com/"
44+
git config --global --add url."https://x-access-token:${{ secrets.DUROXIDE_PG_OPT_TOKEN }}@github.com/".insteadOf "https://api.github.com/"
45+
46+
# Warm the Cargo git/db caches so later `cargo update/test` is fast and reliable.
47+
- name: Prefetch Rust dependencies (including private git deps)
48+
run: |
49+
cargo fetch

0 commit comments

Comments
 (0)