Skip to content

Commit c0242a2

Browse files
brunoborgesCopilot
andcommitted
Update check-new-jdk workflow for JSON-first architecture
- Create individual category/slug.json files instead of editing data/snippets.json - No longer create HTML files manually — generate.py handles that - Add prev/next/related fields to snippet schema - Run generate.py to verify the build before creating PR Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 423419e commit c0242a2

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

.github/workflows/check-new-jdk.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ code comparisons showing old Java patterns next to their modern replacements.
3737
1. **Check for new OpenJDK releases.**
3838
- Fetch the OpenJDK project page at `https://openjdk.org/projects/jdk/` and identify the
3939
latest GA (General Availability) JDK release.
40-
- Compare it against the site's current coverage. Read `data/snippets.json` to see which
40+
- Compare it against the site's current coverage. Read the existing JSON snippet files in
41+
the category subfolders (e.g., `language/*.json`, `concurrency/*.json`) to see which
4142
JDK versions are already covered.
4243
- If the latest GA release is already fully covered, stop and report "No new JDK release to cover."
4344

@@ -49,33 +50,41 @@ code comparisons showing old Java patterns next to their modern replacements.
4950
unless they have a clear developer-facing usage pattern.
5051
- Also note any features that graduated from preview to final in this release.
5152

52-
3. **Propose new snippets.**
53-
- For each relevant new feature, draft a snippet entry in the same JSON format used in
54-
`data/snippets.json`. Each snippet needs:
55-
- `slug`: kebab-case URL slug
53+
3. **Create new snippet JSON files.**
54+
- Each snippet is an individual JSON file at `{category}/{slug}.json`.
55+
- Use an existing JSON file (e.g., `language/type-inference-with-var.json`) as a reference
56+
for the schema. Each snippet needs:
57+
- `id`: next sequential integer
58+
- `slug`: kebab-case URL slug (must match the filename without `.json`)
5659
- `title`: human-readable title
57-
- `category`: one of language, collections, strings, streams, concurrency, io, errors, datetime, security, tooling
60+
- `category`: one of language, collections, strings, streams, concurrency, io, errors, datetime, security, tooling (must match the parent folder)
5861
- `difficulty`: beginner, intermediate, or advanced
5962
- `jdkVersion`: the JDK version where this became final (non-preview)
6063
- `oldLabel` / `modernLabel`: e.g., "Java 8" / "Java 26+"
6164
- `oldApproach` / `modernApproach`: short description of each approach
6265
- `oldCode` / `modernCode`: complete, compilable code snippets (concise, max ~12 lines each)
6366
- `summary`: one-sentence summary
6467
- `explanation`: 2-3 sentence explanation of why the modern approach is better
65-
- `whyModernWins`: array of 3 objects with icon, title, desc
68+
- `whyModernWins`: array of exactly 3 objects with `icon`, `title`, `desc`
6669
- `support`: version info string, e.g., "Finalized in JDK 26 (JEP NNN, Month Year)."
70+
- `prev`: `category/slug` of the previous pattern, or `null` if first
71+
- `next`: `category/slug` of the next pattern, or `null` if last
72+
- `related`: array of exactly 3 `category/slug` strings for related patterns
6773

68-
4. **Make the changes.**
69-
- Add the new snippets to `data/snippets.json` (append to the array, assign sequential IDs).
70-
- For each new snippet, create a `{slug}.html` article page following the exact same HTML
71-
template structure as existing article pages (e.g., `records-for-data-classes.html`).
72-
- Add a card for each new snippet to `index.html` inside the `#tipsGrid` div.
74+
4. **Update existing files.**
75+
- Update the `next` field of the last existing snippet's JSON file to point to the first
76+
new snippet, and set the new snippet's `prev` accordingly. Chain all new snippets together.
77+
- Add a preview card for each new snippet to `index.html` inside the `#tipsGrid` div.
7378
- Update the snippet count wherever it appears in `index.html` (hero-badge, section-badge,
7479
structured data `numberOfItems`).
75-
- Update prev/next navigation links on the last existing article page to point to the first
76-
new page, and chain the new pages together.
80+
- Do **NOT** edit `data/snippets.json` or any HTML files in category subfolders — these are
81+
generated by `generate.py` and must not be modified directly.
7782

78-
5. **Create a pull request.**
83+
5. **Verify the build.**
84+
- Run `python3 generate.py` to regenerate all HTML pages and `data/snippets.json`.
85+
- Confirm the new pages were generated successfully.
86+
87+
6. **Create a pull request.**
7988
- The PR title should be: `[new-jdk] Add snippets for JDK {version} features`
8089
- The PR body should list each new snippet with its title and a one-line summary.
8190
- Mention which JEPs are covered and link to the OpenJDK release page.
@@ -84,7 +93,8 @@ code comparisons showing old Java patterns next to their modern replacements.
8493

8594
- Only include features that are **final** (non-preview) in the new JDK release.
8695
- Label preview features as preview if you choose to include them, with "(Preview)" in the modernLabel.
87-
- Ensure all code in HTML files is properly HTML-escaped.
88-
- Do not modify existing snippets unless a feature graduated from preview to final.
96+
- All content goes in `{category}/{slug}.json` files — never edit generated HTML or `data/snippets.json`.
97+
- Run `python3 generate.py` after making changes to verify the build.
98+
- Do not modify existing snippet JSON files unless a feature graduated from preview to final.
8999
- If a previously preview feature is now final, update its `modernLabel` and `support` text
90-
to remove the "(Preview)" label.
100+
to remove the "(Preview)" label in its JSON file.

0 commit comments

Comments
 (0)