-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (81 loc) · 3.41 KB
/
copilot-setup-steps.yml
File metadata and controls
85 lines (81 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: "Copilot Setup Steps"
# This workflow configures the environment for GitHub Copilot Agent with gh-aw MCP server
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called 'copilot-setup-steps' to be recognized by GitHub Copilot Agent
copilot-setup-steps:
runs-on: ubuntu-latest
# Set minimal permissions for setup steps
# Copilot Agent receives its own token with appropriate permissions
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- name: Set up Clojure
uses: DeLaGuardo/setup-clojure@13.5.2
with:
cli: 1.12.4.1582
bb: 1.12.214
- name: Cache Clojure deps
uses: actions/cache@v5
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
.cpcache
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
restore-keys: cljdeps-
- name: Symlink tools to standard PATH
run: |
sudo ln -sf $(which bb) /usr/local/bin/bb
sudo ln -sf $(which clj) /usr/local/bin/clj
sudo ln -sf $(which clojure) /usr/local/bin/clojure
sudo ln -sf $(which java) /usr/local/bin/java
- name: Pre-download Clojure deps and ensure global access
run: |
# Download Maven deps via system clojure
clojure -P
# Also resolve bb.edn deps (org.clojure/clojure)
bb clojure -P
# Copy the tools jar to ~/.deps.clj/ so bb can find it.
# bb's deps.clj delegates to system clojure when it's on PATH,
# so bb clojure -P never writes the jar to ~/.deps.clj/.
CLJ_VER=$(clojure --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1)
INSTALL_DIR="${CLOJURE_INSTALL_DIR:-}"
if [ -z "$INSTALL_DIR" ]; then
INSTALL_DIR=$(grep '^install_dir=' "$(which clojure)" 2>/dev/null | cut -d= -f2-)
fi
if [ -n "$CLJ_VER" ] && [ -n "$INSTALL_DIR" ]; then
TOOLS_TARGET="$HOME/.deps.clj/$CLJ_VER/ClojureTools"
SRC_JAR=$(find "$INSTALL_DIR" -name "clojure-tools-$CLJ_VER.jar" -print -quit 2>/dev/null)
if [ -n "$SRC_JAR" ] && [ ! -f "$TOOLS_TARGET/clojure-tools-$CLJ_VER.jar" ]; then
mkdir -p "$TOOLS_TARGET"
cp "$SRC_JAR" "$TOOLS_TARGET/"
echo "Copied tools jar to $TOOLS_TARGET"
fi
fi
# Inside the awf sandbox $HOME is /root (container runs as root).
# The workflow mounts .m2 and .deps.clj to both /home/runner/ and
# /root/ paths, so bb finds them regardless of $HOME.
# Ensure deps directories are readable by any user
chmod -R a+rX ~/.m2/repository ~/.deps.clj 2>/dev/null || true
- name: Export Copilot token for SDK E2E tests
run: |
# Make the GitHub token available as COPILOT_GITHUB_TOKEN so the
# Copilot SDK E2E tests and examples can authenticate with the
# same token the Copilot Coding Agent uses.
echo "COPILOT_GITHUB_TOKEN=${COPILOT_GITHUB_TOKEN:-$GITHUB_TOKEN}" >> "$GITHUB_ENV"
- name: Install gh-aw extension
uses: github/gh-aw/actions/setup-cli@v0.48.1
with:
version: v0.48.1