1
---
2
name: "Advanced Copilot CLI Content Sync"
3
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."
4
on:
5
schedule: weekly
6
permissions:
7
contents: read
8
copilot-requests: write
9
tools:
10
github:
11
toolsets: [repos]
12
cache-memory: true
13
safe-outputs:
14
create-pull-request:
15
labels: [automated-update, learning-hub, advanced-copilot-cli]
16
title-prefix: "[bot] "
17
base-branch: main
18
allowed-files:
19
- "website/src/content/docs/learning-hub/advanced-copilot-cli/**"
20
- "website/public/images/learning-hub/advanced-copilot-cli/**"
21
- "website/astro.config.mjs"
22
- "website/src/content/docs/learning-hub/index.md"
23
---
24
25
# Advanced Copilot CLI Content Sync
26
27
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.
28
29
## Step 1 — Determine what's new in the upstream repo
30
31
1. Read `cache-memory` and look for a file named `advanced-copilot-cli-sync-state.json`. It may contain:
32
- `last_synced_sha` — the most recent commit SHA you processed on your previous run
33
- `last_synced_at` — a filesystem-safe timestamp in the format `YYYY-MM-DD-HH-MM-SS`
34
35
2. Use GitHub tools to fetch recent commits from `github-samples/advanced-copilot-cli` (default branch):
36
- If `last_synced_sha` exists, list commits **since that SHA** (stop once you reach it).
37
- If no cached state exists, list commits from the **past 7 days**.
38
39
3. Identify which files changed across those commits. Focus on:
40
- Markdown files under `content/` — the course module content
41
- Supporting assets referenced by the course material, especially screenshots and GIFs under `content/images/`
42
- Any configuration or metadata files that materially affect the course content or navigation
43
44
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.
45
46
## Step 2 — Read the changed upstream content
47
48
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:
49
50
- New sections, commands, flags, or concepts introduced
51
- Renamed or restructured sections
52
- Deprecated commands or workflows that have been removed
53
- Updated screenshots, GIFs, image references, or code examples
54
- Links to new official documentation or resources
55
56
## Step 3 — Compare against the local Learning Hub content
57
58
Read the local files in the canonical Learning Hub course folder `website/src/content/docs/learning-hub/advanced-copilot-cli/`:
59
60
```
61
website/src/content/docs/learning-hub/advanced-copilot-cli/
62
├── index.md
63
├── 00-prerequisites.md
64
├── 01-working-with-copilot-cli.md
65
├── 02-building-ai-infrastructure.md
66
├── 03-test-suite-remote-delegation.md
67
├── 04-lifecycle-hooks.md
68
├── 05-add-feature-barcode.md
69
├── 06-modernize-apps.md
70
├── 07-manage-infrastructure.md
71
└── 08-wrap-up.md
72
```
73
74
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.
75
76
Also inspect local course assets in `website/public/images/learning-hub/advanced-copilot-cli/` when upstream changes touch screenshots, banners, or GIFs.
77
78
If the upstream changes alter course structure or navigation, you may also need to inspect:
79
80
- `website/astro.config.mjs`
81
- `website/src/content/docs/learning-hub/index.md`
82
83
Map the upstream changes to the relevant local file(s). Ask yourself:
84
85
- Is the local mirror missing any upstream content, structure, assignments, examples, or visuals?
86
- Is any existing Learning Hub content now outdated or incorrect based on upstream changes?
87
- Do local route rewrites, repo-link rewrites, or asset paths need updating so the mirrored pages still work on the website?
88
- Do the Astro frontmatter fields (especially `lastUpdated`) need updating because the mirrored page changed?
89
90
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.
91
92
## Step 4 — Update the Learning Hub files
93
94
For each local file that needs updating:
95
96
1. Edit the relevant local docs, assets, and supporting navigation files so the website remains a **source-faithful mirror** of the upstream course:
97
- Add or update missing concepts, commands, flags, steps, assignments, demos, and visuals
98
- Correct or remove outdated information
99
- Localize newly added screenshots or GIFs into `website/public/images/learning-hub/advanced-copilot-cli/`
100
- Bump the `lastUpdated` frontmatter field to today's date (`YYYY-MM-DD`) for any page whose mirrored content changed
101
102
2. Keep a **mirror-first** approach:
103
- Preserve upstream wording, headings, section order, assignments, and overall module flow as closely as practical
104
- Do not summarize, reinterpret, or "website-optimize" the course into a different learning experience
105
- 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
106
- 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/`)
107
- Rewrite local image references (for example ``) to the localized website path `/images/learning-hub/advanced-copilot-cli/<filename>`
108
- 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)
109
110
3. If upstream adds, removes, or renames major sections or modules:
111
- Create, delete, or rename the corresponding markdown files in `website/src/content/docs/learning-hub/advanced-copilot-cli/`
112
- Update `website/astro.config.mjs` if the sidebar module list must change
113
- Update `website/src/content/docs/learning-hub/index.md` only if the landing page's course entry must change
114
115
## Step 5 — Update the sync state cache
116
117
Before opening the PR, write an updated `advanced-copilot-cli-sync-state.json` to `cache-memory` with:
118
119
```json
120
{
121
"last_synced_sha": "<latest commit SHA from github-samples/advanced-copilot-cli>",
122
"last_synced_at": "<YYYY-MM-DD-HH-MM-SS>",
123
"files_reviewed": ["<list of upstream files you compared>"],
124
"files_updated": ["<list of local Learning Hub files you edited>"]
125
}
126
```
127
128
## Step 6 — Open a pull request
129
130
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:
131
132
1. **What changed upstream** — a concise summary of the commits and file changes found in `github-samples/advanced-copilot-cli`
133
2. **What was updated locally** — list each mirrored Learning Hub file or asset you edited and what changed
134
3. **Source links** — links to the relevant upstream commits or files
135
4. A note that the markdown body of this workflow can be edited directly on GitHub.com without recompilation
136
137
If there is nothing to change after your analysis, do **not** open a PR. Instead, call the `noop` safe output.
138
139
## Guidelines
140
141
- The canonical course content lives in `website/src/content/docs/learning-hub/advanced-copilot-cli/`; do not recreate legacy duplicates elsewhere
142
- Prefer changes within the course docs and `website/public/images/learning-hub/advanced-copilot-cli/`
143
- Only edit `website/astro.config.mjs` or `website/src/content/docs/learning-hub/index.md` when upstream course structure or navigation truly requires it
144
- Preserve existing frontmatter fields; only update `lastUpdated` and `description` if genuinely warranted
145
- Keep the course source-faithful; avoid summaries or interpretive rewrites
146
- Use `main` as the base branch for any branch or PR created by this workflow
147
- Do not auto-merge; the PR is for human review
148
- 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
149
- Always call either `create-pull-request` or `noop` at the end of your run so the workflow clearly signals its outcome
150