Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# ─────────────────────────────────────────────────────────────────────────────
# SOURCE OF TRUTH: petry-projects/.github/standards/workflows/copilot-setup-steps.yml
# Standard: petry-projects/.github/standards/ci-standards.md#11-copilot-cloud-agent-setup
#
# ADOPTING THIS WORKFLOW:
# 1. Copy this file to .github/workflows/copilot-setup-steps.yml in your repo.
# 2. Keep every REQUIRED section — do NOT remove the checkout or verify steps.
# 3. Uncomment and adapt the stack blocks that match your repo's tech stack.
# 4. Delete (not just comment out) stacks that do not apply after initial setup.
# 5. Merge to the default branch — the workflow only triggers from the default branch.
# 6. Run manually from Actions → "Copilot Setup Steps" → "Run workflow" to verify.
#
# WHAT THIS FILE DOES:
# Bootstraps Copilot cloud agent's ephemeral environment BEFORE the agent starts
# working on your repo. Pre-installing dependencies deterministically:
# • Speeds up every agent session (no trial-and-error dependency discovery)
# • Makes private/internal packages available (impossible for the agent alone)
# • Ensures exact tool versions that match your CI pipeline
# Without this file the agent installs dependencies itself — slower, non-deterministic,
# and unreliable for repos with private packages or complex build graphs.
#
# SEE ALSO:
# AGENTS.md — authoritative development standards for this repo
# .github/copilot-instructions.md — always-on Copilot instructions (summary of AGENTS.md)
# .github/instructions/ — path-scoped instruction files per language
#
# CONSTRAINTS (enforced by GitHub, documented at docs.github.com):
# • Job MUST be named `copilot-setup-steps` to be recognized by Copilot cloud agent
# • timeout-minutes maximum: 59 (hard limit)
# • Customizable fields: steps, permissions, runs-on, services, snapshot, timeout-minutes
# • All other job-level settings are silently ignored by GitHub
# • fetch-depth on checkout is always overridden by the agent — do not rely on it here
# • This file MUST be present on the default branch to take effect
#
# STACK: documentation / scripts only — no build dependencies to install
# ─────────────────────────────────────────────────────────────────────────────
Comment on lines +33 to +36

name: "Copilot Setup Steps"

on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

permissions: {}

jobs:
copilot-setup-steps:
# Skip on fork-origin pull requests — forks cannot access org secrets required for private packages.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false

runs-on: ubuntu-latest
timeout-minutes: 10

permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Verify environment
run: |
Comment on lines +63 to +67

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add dependency bootstrap steps before verification

This workflow never installs the project toolchain or dependencies: after checkout it jumps directly to Verify environment, so Copilot sessions start without node_modules and without a pinned Node version. In this repository’s Node/Electron stack, agent tasks that run lint/typecheck/tests can fail or spend significant time doing ad-hoc installs, which defeats the stated purpose of deterministic pre-setup for the cloud agent.

Useful? React with 👍 / 👎.

echo "=== petry-projects Copilot cloud agent environment ==="
echo "Repository : ${{ github.repository }}"
echo "Ref : ${{ github.ref }}"
echo "Runner : ${{ runner.os }} / ${{ runner.arch }}"
echo ""
echo "--- Installed tool versions ---"
git --version
gh --version 2>/dev/null | head -1 || echo "gh: not installed"
echo ""
echo "--- Agent instruction files ---"
if [ -f "AGENTS.md" ]; then
echo "✅ AGENTS.md ($(wc -l < AGENTS.md) lines)"
else
echo "❌ AGENTS.md — MISSING. Add this file per agent-standards.md."
exit 1
fi
if [ -f ".github/copilot-instructions.md" ]; then
echo "✅ .github/copilot-instructions.md"
else
echo "ℹ️ .github/copilot-instructions.md — not present (optional but recommended)"
fi
INSTR_COUNT=0
if [ -d ".github/instructions" ]; then
INSTR_COUNT=$(find .github/instructions -name "*.instructions.md" | wc -l)
fi
echo "ℹ️ .github/instructions/: ${INSTR_COUNT} file(s)"
echo ""
echo "✅ Setup complete — Copilot cloud agent is ready to work"
Loading