Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Get Azure VM and VM Scale Set recommendations based on workload, performance, and budget needs.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
workflows/vm-creator/references/delivery-options/github-pr.md
1# Mode C — Sync to a GitHub repo23## Step 1 — Gather repo + branch + path45Ask three things (batch into one message; accept all three at once or walk through them):671. **Repo** — accept any of:8- `owner/name` (e.g., `myorg/azure-infra`)9- Full URL (e.g., `https://github.com/myorg/azure-infra`)10- Local checkout path (e.g., `~/source/azure-infra`) — skips clone112. **Branch** — default: `infra/vm-{vm-name}`. **Refuse to commit directly to `main` / `master` / default.** Always a branch + PR.123. **Target path inside repo** — default: `infra/{vm-name}/`. If the repo has a recognizable infra root (`/terraform`, `/bicep`, `/infrastructure`), suggest that.1314## Step 2 — Pre-flight1516```bash17# 1. gh installed and authenticated18gh auth status # must succeed; if not, fall back to Mode C-fallback below1920# 2. user has push rights21gh repo view {owner/repo} --json viewerPermission --jq '.viewerPermission'22# Must be ADMIN, MAINTAIN, or WRITE; otherwise pivot to fork-and-PR2324# 3. branch doesn't already exist25gh api repos/{owner/repo}/branches/{branch} # 404 = good (new branch)26```2728If `gh` is missing or unauthenticated, **switch to Mode C-fallback** — don't block.2930## Step 3 — Clone, write, commit, push, PR3132Echo each command so the user can replay:3334```bash35# 1. Working tree36TMP=$(mktemp -d) && cd "$TMP"37gh repo clone {owner/repo} .3839# 2. Branch off the default branch40DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')41git checkout -b {branch} "origin/$DEFAULT_BRANCH"4243# 3. Write the artifact files (same layout as Mode B)44mkdir -p {targetPath}45# ... Write tool calls for each file ...4647# 4. Stage, commit, push48git add {targetPath}49git commit -m "Add {vm-name} VM infrastructure (Bicep)" \50-m "Generated by azure-compute vm-creator workflow."51git push -u origin {branch}5253# 5. Open the PR54gh pr create \55--title "Add {vm-name} VM infrastructure" \56--body "$(cat <<'EOF'57## Summary58Adds Bicep templates to provision \`{vm-name}\` in \`{location}\`.5960## Plan Card61{paste-plan-card-markdown}6263## Deploy64\`\`\`bash65cd {targetPath}66az deployment group create --resource-group {resourceGroup} \\67--template-file main.bicep --parameters vmName={vm-name} ...68\`\`\`69EOF70)" \71--base "$DEFAULT_BRANCH" --head {branch}72```7374Echo the PR URL back:7576> ✅ Opened PR: https://github.com/myorg/azure-infra/pull/427778## Step 4 — Optional follow-ups7980After the PR is open, **offer** (don't force):81- *"Want me to add a GitHub Action to validate this with `az deployment group what-if` on every PR?"* — generates `.github/workflows/bicep-whatif.yml`82- *"Want OIDC auth so CI can apply without a service principal secret?"* — points at the `azure-prepare` skill8384## Mode C-fallback (no `gh` / unauthenticated / no push rights)8586Write the files to `~/Desktop/{vm-name}-infra/` (Mode B path) and print:8788> ⚠ I can't push for you (`gh auth status` failed), so I wrote the files locally.89>90> To open the PR yourself:91> ```bash92> cd ~/Desktop/dev-vm-infra93> git init && git add . && git commit -m "Add dev-vm infrastructure"94> git remote add origin [email protected]:myorg/azure-infra.git95> git checkout -b infra/vm-dev-vm96> git push -u origin infra/vm-dev-vm97> gh pr create --fill # after `gh auth login`98> ```99