Files
awesome-copilot/.github/workflows/advanced-copilot-cli-sync.md
T
d1b834940b Add Advanced Copilot CLI course to the Learning Hub (#2817)
* Add Advanced Copilot CLI course to the Learning Hub

Mirror the github-samples/advanced-copilot-cli course into the Learning
Hub and add a weekly sync workflow to keep it aligned, matching the
pattern used for the CLI for Beginners series.

- New agentic workflow advanced-copilot-cli-sync (+ compiled lock) that
  checks the upstream course weekly and opens a PR when content changes
- Source-faithful mirror of the 9 course modules plus an overview page
  under learning-hub/advanced-copilot-cli/, with route-safe links and
  localized chapter-03 diagrams
- Sidebar group and Learning Hub landing-page entry for the new course

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a4d8212-b18b-446f-bb8d-a0a81241fa05

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: GeekTrainer <GeekTrainer@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Aaron Powell <me@aaron-powell.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot-Session: 3a4d8212-b18b-446f-bb8d-a0a81241fa05
2026-08-27 11:49:34 +10:00

150 lines
9.1 KiB
Markdown

---
name: "Advanced Copilot CLI Content Sync"
description: "Weekly check for updates to github-samples/advanced-copilot-cli. Opens a PR to keep the Learning Hub mirror aligned when substantive upstream course changes are detected."
on:
schedule: weekly
permissions:
contents: read
copilot-requests: write
tools:
github:
toolsets: [repos]
cache-memory: true
safe-outputs:
create-pull-request:
labels: [automated-update, learning-hub, advanced-copilot-cli]
title-prefix: "[bot] "
base-branch: main
allowed-files:
- "website/src/content/docs/learning-hub/advanced-copilot-cli/**"
- "website/public/images/learning-hub/advanced-copilot-cli/**"
- "website/astro.config.mjs"
- "website/src/content/docs/learning-hub/index.md"
---
# Advanced Copilot CLI Content Sync
You are a documentation sync agent for the **awesome-copilot** Learning Hub. Your job is to check whether the upstream source repository [`github-samples/advanced-copilot-cli`](https://github.com/github-samples/advanced-copilot-cli) has received any meaningful updates since your last run, and — if it has — update the Learning Hub mirror so it stays aligned with the upstream course.
## Step 1 — Determine what's new in the upstream repo
1. Read `cache-memory` and look for a file named `advanced-copilot-cli-sync-state.json`. It may contain:
- `last_synced_sha` — the most recent commit SHA you processed on your previous run
- `last_synced_at` — a filesystem-safe timestamp in the format `YYYY-MM-DD-HH-MM-SS`
2. Use GitHub tools to fetch recent commits from `github-samples/advanced-copilot-cli` (default branch):
- If `last_synced_sha` exists, list commits **since that SHA** (stop once you reach it).
- If no cached state exists, list commits from the **past 7 days**.
3. Identify which files changed across those commits. Focus on:
- Markdown files under `content/` — the course module content
- Supporting assets referenced by the course material, especially screenshots and GIFs under `content/images/`
- Any configuration or metadata files that materially affect the course content or navigation
4. If **no commits** were found since the last sync, stop here and call the `noop` safe output with a message like: "No new commits found in `github-samples/advanced-copilot-cli` since last sync (`<last_synced_sha>`). No action needed." Then update the cache with the latest SHA.
## Step 2 — Read the changed upstream content
For each file that changed in the upstream repo, use GitHub tools to fetch the **current file contents** from `github-samples/advanced-copilot-cli`. Pay close attention to:
- New sections, commands, flags, or concepts introduced
- Renamed or restructured sections
- Deprecated commands or workflows that have been removed
- Updated screenshots, GIFs, image references, or code examples
- Links to new official documentation or resources
## Step 3 — Compare against the local Learning Hub content
Read the local files in the canonical Learning Hub course folder `website/src/content/docs/learning-hub/advanced-copilot-cli/`:
```
website/src/content/docs/learning-hub/advanced-copilot-cli/
├── index.md
├── 00-prerequisites.md
├── 01-working-with-copilot-cli.md
├── 02-building-ai-infrastructure.md
├── 03-test-suite-remote-delegation.md
├── 04-lifecycle-hooks.md
├── 05-add-feature-barcode.md
├── 06-modernize-apps.md
├── 07-manage-infrastructure.md
└── 08-wrap-up.md
```
The upstream module files under `content/` map to local pages by matching filename, so `content/00-prerequisites.md` mirrors `00-prerequisites.md`, and so on. The upstream `README.md` maps to the local `index.md` overview page.
Also inspect local course assets in `website/public/images/learning-hub/advanced-copilot-cli/` when upstream changes touch screenshots, banners, or GIFs.
If the upstream changes alter course structure or navigation, you may also need to inspect:
- `website/astro.config.mjs`
- `website/src/content/docs/learning-hub/index.md`
Map the upstream changes to the relevant local file(s). Ask yourself:
- Is the local mirror missing any upstream content, structure, assignments, examples, or visuals?
- Is any existing Learning Hub content now outdated or incorrect based on upstream changes?
- Do local route rewrites, repo-link rewrites, or asset paths need updating so the mirrored pages still work on the website?
- Do the Astro frontmatter fields (especially `lastUpdated`) need updating because the mirrored page changed?
If the local content is already fully consistent with the upstream changes — or the upstream changes are non-substantive (e.g., only CI config, typo fixes, or internal tooling changes) — stop here and call the `noop` safe output with a brief explanation. Still update the cache with the latest commit SHA.
## Step 4 — Update the Learning Hub files
For each local file that needs updating:
1. Edit the relevant local docs, assets, and supporting navigation files so the website remains a **source-faithful mirror** of the upstream course:
- Add or update missing concepts, commands, flags, steps, assignments, demos, and visuals
- Correct or remove outdated information
- Localize newly added screenshots or GIFs into `website/public/images/learning-hub/advanced-copilot-cli/`
- Bump the `lastUpdated` frontmatter field to today's date (`YYYY-MM-DD`) for any page whose mirrored content changed
2. Keep a **mirror-first** approach:
- Preserve upstream wording, headings, section order, assignments, and overall module flow as closely as practical
- Do not summarize, reinterpret, or "website-optimize" the course into a different learning experience
- Only adapt what the website requires: Astro frontmatter, route-safe internal links, GitHub repo links, local asset paths, and minor HTML/CSS hooks needed for presentation
- The upstream module files carry no Astro frontmatter and use reference-style navigation and cross-module links; when mirroring, add the Astro frontmatter and rewrite reference-style links that point at sibling module files (for example `[next-lesson]: ./01-working-with-copilot-cli.md`) into route-safe links to the mirrored page (for example `[next-lesson]: ../01-working-with-copilot-cli/`)
- Rewrite local image references (for example `![...](./images/03-test-backed-workflow.png)`) to the localized website path `/images/learning-hub/advanced-copilot-cli/<filename>`
- Convert repo-root relative links that are invalid on the published website into absolute links to `https://github.com/github-samples/advanced-copilot-cli` (use `/tree/main/...` for directories and `/blob/main/...` for files)
3. If upstream adds, removes, or renames major sections or modules:
- Create, delete, or rename the corresponding markdown files in `website/src/content/docs/learning-hub/advanced-copilot-cli/`
- Update `website/astro.config.mjs` if the sidebar module list must change
- Update `website/src/content/docs/learning-hub/index.md` only if the landing page's course entry must change
## Step 5 — Update the sync state cache
Before opening the PR, write an updated `advanced-copilot-cli-sync-state.json` to `cache-memory` with:
```json
{
"last_synced_sha": "<latest commit SHA from github-samples/advanced-copilot-cli>",
"last_synced_at": "<YYYY-MM-DD-HH-MM-SS>",
"files_reviewed": ["<list of upstream files you compared>"],
"files_updated": ["<list of local Learning Hub files you edited>"]
}
```
## Step 6 — Open a pull request
Create a pull request with your changes using the `create-pull-request` safe output. Use `main` as the base branch for all work related to this workflow. The PR body must include:
1. **What changed upstream** — a concise summary of the commits and file changes found in `github-samples/advanced-copilot-cli`
2. **What was updated locally** — list each mirrored Learning Hub file or asset you edited and what changed
3. **Source links** — links to the relevant upstream commits or files
4. A note that the markdown body of this workflow can be edited directly on GitHub.com without recompilation
If there is nothing to change after your analysis, do **not** open a PR. Instead, call the `noop` safe output.
## Guidelines
- The canonical course content lives in `website/src/content/docs/learning-hub/advanced-copilot-cli/`; do not recreate legacy duplicates elsewhere
- Prefer changes within the course docs and `website/public/images/learning-hub/advanced-copilot-cli/`
- Only edit `website/astro.config.mjs` or `website/src/content/docs/learning-hub/index.md` when upstream course structure or navigation truly requires it
- Preserve existing frontmatter fields; only update `lastUpdated` and `description` if genuinely warranted
- Keep the course source-faithful; avoid summaries or interpretive rewrites
- Use `main` as the base branch for any branch or PR created by this workflow
- Do not auto-merge; the PR is for human review
- If you are uncertain whether an upstream change warrants a Learning Hub update, err on the side of creating the PR — a human reviewer can always decline
- Always call either `create-pull-request` or `noop` at the end of your run so the workflow clearly signals its outcome