From 10cd38d868ad5523dc7fd40c8bc0df8b106727f1 Mon Sep 17 00:00:00 2001 From: Don Petry <36422719+don-petry@users.noreply.github.com> Date: Wed, 20 May 2026 21:58:05 -0500 Subject: [PATCH 1/3] feat: add copilot-setup-steps.yml for Copilot cloud agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bootstrap Copilot cloud agent's ephemeral environment before it starts working. Pre-installs Node.js 24 and npm dependencies deterministically, matching the CI pipeline configuration. - Checkout code and install npm dependencies (npm ci) - Verifies AGENTS.md presence as a gate check - Implements petry-projects org standard (ci-standards.md §11) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/copilot-setup-steps.yml | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/copilot-setup-steps.yml diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 00000000..b8d2e210 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,102 @@ +# ───────────────────────────────────────────────────────────────────────────── +# 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 (TypeScript + Electron desktop app) +# ───────────────────────────────────────────────────────────────────────────── + +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: + if: github.event.repository.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: "24" + cache: "npm" + + - name: Install Node.js dependencies + run: npm ci + + - 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=$(find .github/instructions -name "*.instructions.md" 2>/dev/null | wc -l) + echo "ℹ️ .github/instructions/: ${INSTR_COUNT} file(s)" + echo "" + echo "✅ Setup complete — Copilot cloud agent is ready to work" From 344e1e2a4ef18d7e165d71a0b2b5b2952805b6ba Mon Sep 17 00:00:00 2001 From: Don Petry <36422719+don-petry@users.noreply.github.com> Date: Wed, 20 May 2026 22:02:41 -0500 Subject: [PATCH 2/3] fix: correct fork guard and instructions dir check in copilot-setup-steps.yml - Fork guard: replace github.event.repository.fork (reflects base repo, always false for org repos) with github.event_name != 'pull_request' || head.repo.fork == false so external fork PRs are skipped while direct pushes and manual runs still run - Verify step: guard find .github/instructions with [ -d ] check to prevent pipefail abort when the directory is absent Addresses review comments on petry-projects/.github#328 (Codex P1 and P2). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/copilot-setup-steps.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index b8d2e210..93710a6c 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -50,7 +50,8 @@ permissions: {} jobs: copilot-setup-steps: - if: github.event.repository.fork == false + # 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 @@ -96,7 +97,10 @@ jobs: else echo "ℹ️ .github/copilot-instructions.md — not present (optional but recommended)" fi - INSTR_COUNT=$(find .github/instructions -name "*.instructions.md" 2>/dev/null | wc -l) + 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" From 89cdcd1e7c4723a7d35f05e5089def876c70dbae Mon Sep 17 00:00:00 2001 From: Don Petry <36422719+don-petry@users.noreply.github.com> Date: Thu, 21 May 2026 06:27:18 -0500 Subject: [PATCH 3/3] fix: make copilot setup workflow docs-only for current TalkTerm main TalkTerm default branch currently contains docs/scripts and no lockfile, so npm setup steps fail. Switch to checkout + verify only (same docs-only pattern used in ContentTwin and bmad-bgreat-suite) until app source lands. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/copilot-setup-steps.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 93710a6c..a7a21d4c 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -32,7 +32,7 @@ # • 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 (TypeScript + Electron desktop app) +# STACK: documentation / scripts only — no build dependencies to install # ───────────────────────────────────────────────────────────────────────────── name: "Copilot Setup Steps" @@ -54,7 +54,7 @@ jobs: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 10 permissions: contents: read @@ -63,15 +63,6 @@ jobs: - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Set up Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version: "24" - cache: "npm" - - - name: Install Node.js dependencies - run: npm ci - - name: Verify environment run: | echo "=== petry-projects Copilot cloud agent environment ===" @@ -82,8 +73,6 @@ jobs: 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