Add the 2022-11-28 section to GHES REST breaking changes changelog (#… · github/docs@706add0 · GitHub
Skip to content

Commit 706add0

Browse files
heiskrCopilot
andauthored
Add the 2022-11-28 section to GHES REST breaking changes changelog (#64112)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: bf5940de-658e-4a1a-bffa-3018fb78b138
1 parent 6189093 commit 706add0

3 files changed

Lines changed: 88 additions & 6 deletions

File tree

‎data/reusables/rest-api/breaking-changes-changelog.md‎

Lines changed: 39 additions & 0 deletions

‎src/rest/scripts/utils/sync-changelogs.ts‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const OUTPUT_PATH = 'data/reusables/rest-api/breaking-changes-changelog.md'
1010
interface VersionMapping {
1111
sourceDir: string
1212
ifversionExpr: string
13+
shortName: string
1314
}
1415

1516
interface VersionSection {
@@ -18,7 +19,8 @@ interface VersionSection {
1819
}
1920

2021
// The initial REST API version predates rest-api-description changelogs, so
21-
// this fallback keeps the generated output complete. Keyed by ifversion expression.
22+
// this fallback keeps the generated output complete. Keyed by product short name.
23+
// GitHub Enterprise Server shares one entry across all releases.
2224
const INITIAL_VERSION = '2022-11-28'
2325
const INITIAL_VERSION_SECTIONS: Record<string, VersionSection> = {
2426
fpt: {
@@ -29,6 +31,10 @@ const INITIAL_VERSION_SECTIONS: Record<string, VersionSection> = {
2931
version: INITIAL_VERSION,
3032
content: `## Version ${INITIAL_VERSION}\n\nVersion \`${INITIAL_VERSION}\` is the first version of the GitHub Enterprise Cloud REST API after date-based versioning was introduced. This version does not include any breaking changes.`,
3133
},
34+
ghes: {
35+
version: INITIAL_VERSION,
36+
content: `## Version ${INITIAL_VERSION}\n\nVersion \`${INITIAL_VERSION}\` is the first version of the {% data variables.product.prodname_ghe_server %} REST API after date-based versioning was introduced. This version does not include any breaking changes.`,
37+
},
3238
}
3339

3440
// buildVersionMappings maps docs short names to rest-api-description directories
@@ -60,7 +66,7 @@ function buildVersionMappings(versionNames: Record<string, string>): VersionMapp
6066
ifversionExpr = versionObj.shortName
6167
}
6268

63-
mappings.push({ sourceDir, ifversionExpr })
69+
mappings.push({ sourceDir, ifversionExpr, shortName: versionObj.shortName })
6470
}
6571

6672
return mappings
@@ -140,7 +146,7 @@ export async function syncChangelogs(
140146
const mappings = buildVersionMappings(versionNames)
141147
const outputBlocks: string[] = []
142148

143-
for (const { sourceDir, ifversionExpr } of mappings) {
149+
for (const { sourceDir, ifversionExpr, shortName } of mappings) {
144150
const changelogPath = getChangelogPath(sourceRepoDir, sourceDir)
145151

146152
let sections: VersionSection[]
@@ -155,8 +161,8 @@ export async function syncChangelogs(
155161

156162
// Inject the hardcoded initial section when the source changelog lacks it for this product.
157163
const hasInitialVersion = sections.some((s) => s.version === INITIAL_VERSION)
158-
if (!hasInitialVersion && ifversionExpr in INITIAL_VERSION_SECTIONS) {
159-
sections.push(INITIAL_VERSION_SECTIONS[ifversionExpr])
164+
if (!hasInitialVersion && shortName in INITIAL_VERSION_SECTIONS) {
165+
sections.push(INITIAL_VERSION_SECTIONS[shortName])
160166
}
161167

162168
if (sections.length === 0) {

‎src/rest/tests/sync-changelogs.ts‎

Lines changed: 38 additions & 1 deletion

0 commit comments

Comments
 (0)