Skip to content
Merged
Show file tree
Hide file tree
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
106 changes: 106 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# ─────────────────────────────────────────────────────────────────────────────
# 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: Node.js / npm (Google Apps Script, TypeScript, Jest)
# ─────────────────────────────────────────────────────────────────────────────

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: 30

permissions:
contents: read

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

- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: '20'
cache: 'npm'

- name: Install Node.js dependencies
run: npm ci --ignore-scripts

- name: Verify environment
run: |
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"
node --version
npm --version
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"
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading