Skip to content

Merge branch 'main' into copilot/improve-integration-sample-data #31

Merge branch 'main' into copilot/improve-integration-sample-data

Merge branch 'main' into copilot/improve-integration-sample-data #31

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
env:
GITHUB_TOKEN: ${{ secrets.COPILOT_MCP_GITHUB_PERSONAL_ACCESS_TOKEN }}
GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.COPILOT_MCP_GITHUB_PERSONAL_ACCESS_TOKEN }}
DISPLAY: ":99"
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:
contents: read
actions: read
attestations: read
checks: read
deployments: read
issues: write
models: read
discussions: read
pages: read
pull-requests: write
security-events: read
statuses: read
# Steps run before the agent starts working
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# Cache APT packages for faster installs
- name: Cache APT packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: /var/cache/apt/archives
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/copilot-setup-steps.yml') }}
restore-keys: |
${{ runner.os }}-apt-
# Setup complete Web test environment
- name: Setup Web Test Environment (Chrome + Xvfb + Dependencies)
run: |
echo "🔧 Setting up complete Web test environment..."
# Install system dependencies for Web rendering
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
xvfb dbus-x11 x11-utils \
libgtk2.0-0 libgtk-3-0 libgbm-dev libgbm1 \
libnotify-dev libnss3 libxss1 \
libxtst6 xauth \
graphviz ffmpeg \
fonts-noto fonts-noto-cjk fonts-noto-cjk-extra \
ca-certificates fonts-liberation \
libatk-bridge2.0-0 libatk1.0-0 libcups2 \
libdbus-1-3 libdrm2 libnspr4 \
libx11-xcb1 libxcomposite1 libxdamage1 \
libxfixes3 libxrandr2 libxrender1 \
libxshmfence1 xdg-utils wget libxkbcommon0 xkb-data
# Install Google Chrome Stable for Web WebGL support
wget -qO- https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update
sudo apt-get install -y google-chrome-stable
# Setup D-Bus for Chrome
sudo mkdir -p /var/run/dbus
sudo dbus-daemon --system --fork || true
# Verify Chrome installation
google-chrome --version
echo "✅ Web test environment setup complete"
env:
DISPLAY: ":99"
XKB_DEFAULT_RULES: evdev
XKB_DEFAULT_MODEL: pc105
XKB_DEFAULT_LAYOUT: us
# Start Xvfb early for Playwright/Chrome
- name: Start Xvfb
run: |
echo "🖥️ Starting Xvfb virtual display..."
Xvfb :99 -screen 0 1920x1080x24 &
sleep 2
echo "DISPLAY=:99" >> $GITHUB_ENV
echo "✅ Xvfb started on display :99"
# JavaScript/TypeScript setup
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: "24"
- name: Cache dependencies
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Pre-install MCP server packages globally
- name: Install MCP server packages globally
run: |
echo "📦 Installing MCP server packages globally..."
# Install Node.js MCP servers that exist on npm
npm install -g @modelcontextprotocol/server-filesystem
npm install -g @modelcontextprotocol/server-memory
npm install -g @modelcontextprotocol/server-sequential-thinking
# Pre-cache @playwright/mcp for faster startup
npm install -g @playwright/mcp
# Install riksdag-regering-mcp for Swedish political data
npm install -g riksdag-regering-mcp
echo "✅ Node.js MCP server packages installed globally"
# Cache global npm packages for MCP servers
- name: Cache global npm packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: |
~/.npm
/usr/local/lib/node_modules
/usr/local/bin/mcp-server-*
key: ${{ runner.os }}-mcp-servers-v4-${{ hashFiles('.github/copilot-mcp.json') }}
restore-keys: |
${{ runner.os }}-mcp-servers-v4-
# Verify all MCP server installations
- name: Verify MCP server installations
run: |
echo "🔍 Verifying MCP server installations..."
echo "=== Node.js MCP Servers ==="
echo "Checking mcp-server-filesystem..."
which mcp-server-filesystem && echo "✅ mcp-server-filesystem found" || echo "❌ mcp-server-filesystem NOT found"
echo "Checking mcp-server-memory..."
which mcp-server-memory && echo "✅ mcp-server-memory found" || echo "❌ mcp-server-memory NOT found"
echo "Checking mcp-server-sequential-thinking..."
which mcp-server-sequential-thinking && echo "✅ mcp-server-sequential-thinking found" || echo "❌ mcp-server-sequential-thinking NOT found"
echo "Checking @playwright/mcp..."
which mcp-server-playwright 2>/dev/null && echo "✅ mcp-server-playwright found" || echo "ℹ️ @playwright/mcp available via npx"
echo "Checking riksdag-regering-mcp..."
which riksdag-regering-mcp && echo "✅ riksdag-regering-mcp found" || echo "❌ riksdag-regering-mcp NOT found"
echo ""
echo "=== HTTP MCP Servers ==="
echo "📍 GitHub MCP Server: Using HTTP endpoint (https://api.githubcopilot.com/mcp/insiders)"
echo "📍 Riksdag-Regering MCP Server: Using HTTP endpoint (https://riksdag-regering-ai.onrender.com/mcp)"
echo "✅ MCP server verification complete"
- name: Install Playwright browsers (and OS deps)
run: npx playwright install --with-deps
env:
DISPLAY: ":99"
PLAYWRIGHT_BROWSERS_PATH: "0"