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
23 changes: 23 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Ziyada (.NET 9)",
"image": "mcr.microsoft.com/devcontainers/dotnet:1-9.0-bookworm",
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "20"
}
},
"postCreateCommand": "dotnet restore Ziyada.sln && bash .devcontainer/setup-hve-core.sh",
"remoteEnv": {
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
},
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit",
"GitHub.copilot",
"GitHub.copilot-chat"
]
}
}
}
31 changes: 31 additions & 0 deletions .devcontainer/setup-hve-core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# setup-hve-core.sh
#
# Best-effort, non-fatal, idempotent installation of the GitHub Copilot CLI and
# the hve-core-all plugin (https://github.com/microsoft/hve-core).
#
# This script is shared by:
# * the Copilot cloud sandbox setup workflow
# (.github/workflows/copilot-setup-steps.yml), and
# * the dev container (.devcontainer/devcontainer.json).
#
# Every step is best-effort: the sandbox and dev container MUST still start even
# if the Copilot CLI or the plugin cannot be installed (for example when the
# environment is offline or the CLI has not been authenticated). Failures are
# therefore downgraded to warnings and never abort the caller.
set -euo pipefail

echo "==> [hve-core] Ensuring GitHub Copilot CLI is installed"
command -v copilot >/dev/null 2>&1 || npm install -g @github/copilot || echo "::warning::copilot CLI install failed"

echo "==> [hve-core] Adding microsoft/hve-core plugin marketplace"
copilot plugin marketplace add microsoft/hve-core || echo "::warning::marketplace add failed"

echo "==> [hve-core] Installing hve-core-all plugin"
copilot plugin install hve-core-all@hve-core || echo "::warning::hve-core-all install failed"

echo "==> [hve-core] Installed plugins:"
copilot plugin list || true

echo "==> [hve-core] Setup script complete"
68 changes: 68 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: "Copilot Setup Steps"

# Provisions and validates the GitHub Copilot cloud sandbox for this repository.
# The Copilot coding agent runs the job named exactly `copilot-setup-steps`
# before it starts working, so this workflow both bootstraps the sandbox and
# lets us exercise that bootstrap on demand (workflow_dispatch) or whenever the
# setup files themselves change.
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
- .devcontainer/setup-hve-core.sh
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
- .devcontainer/setup-hve-core.sh

permissions:
contents: read

jobs:
# The job name MUST be `copilot-setup-steps` for the Copilot coding agent to
# discover and run it as the sandbox bootstrap.
copilot-setup-steps:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false

# Primary runtime for this repo: .NET 9 (see src/Ziyada/Ziyada.csproj).
- name: Setup .NET
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with:
dotnet-version: '9.0.x'
cache: true
cache-dependency-path: '**/*.csproj'

# Node is required so the Copilot CLI (an npm package) and the
# hve-core-all plugin can be installed, even though this is not a Node repo.
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'

- name: Restore .NET dependencies
continue-on-error: true
run: dotnet restore Ziyada.sln

- name: Install hve-core-all plugin
continue-on-error: true
env:
GITHUB_TOKEN: ${{ github.token }}
run: bash .devcontainer/setup-hve-core.sh

- name: Verify tools
run: |
echo "OS: $(uname -srm)"
echo ".NET SDK: $(dotnet --version 2>/dev/null || echo 'not installed')"
echo "Node: $(node --version 2>/dev/null || echo 'not installed')"
echo "npm: $(npm --version 2>/dev/null || echo 'not installed')"
echo -n "Copilot: "; copilot --version 2>/dev/null || echo 'not installed'
echo "Copilot plugins:"
copilot plugin list 2>/dev/null || echo " (copilot CLI unavailable)"
Loading