Add REST API changelog sync and fix GHES multi-version release bugs (… · github/docs@e69361f · GitHub
Skip to content

Commit e69361f

Browse files
authored
Add REST API changelog sync and fix GHES multi-version release bugs (#59834)
1 parent e073f5a commit e69361f

7 files changed

Lines changed: 643 additions & 22 deletions

File tree

‎content/rest/about-the-rest-api/breaking-changes.md‎

Lines changed: 1 addition & 3 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!-- markdownlint-disable liquid-quoted-conditional-arg search-replace GHD046 -->
2+
{% ifversion fpt %}
3+
{% if query.apiVersion == nil or "2022-11-28" <= query.apiVersion %}
4+
## Version 2022-11-28
5+
6+
Version `2022-11-28` is the first version of the GitHub Free, Pro & Team REST API after date-based versioning was introduced. This version does not include any breaking changes.
7+
8+
{% endif %}
9+
{% endif %}
10+
11+
{% ifversion ghec %}
12+
{% if query.apiVersion == nil or "2022-11-28" <= query.apiVersion %}
13+
## Version 2022-11-28
14+
15+
Version `2022-11-28` 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.
16+
17+
{% endif %}
18+
{% endif %}

‎src/ghes-releases/scripts/deprecate/update-automated-pipelines.ts‎

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,28 +124,44 @@ export async function updateAutomatedPipelines() {
124124
}
125125

126126
// Get a list of data directories to create (release) and create them
127-
// This should only happen if a relase is being added.
127+
// This should only happen if a release is being added.
128128
const addFiles = difference(expectedDirectory, existingDataDir)
129-
if (addFiles.length > numberedReleaseBaseNames.length) {
130-
throw new Error(
131-
'Only one new release per numbered release version should be added at a time. Check that the lib/enterprise-server-releases.ts is correct.',
132-
)
129+
130+
// Verify all new directories belong to the current release
131+
for (const dir of addFiles) {
132+
if (!dir.includes(currentReleaseNumber)) {
133+
throw new Error(
134+
`Unexpected directory to add: ${dir}. Only directories for the current release ` +
135+
`(${currentReleaseNumber}) should be added. Check that the lib/enterprise-server-releases.ts is correct.`,
136+
)
137+
}
133138
}
134139

135140
for (const base of numberedReleaseBaseNames) {
136-
const dirToAdd = addFiles.find((item) => item.startsWith(base))
137-
if (!dirToAdd) continue
138-
// The suppported array is ordered from most recent (index 0) to oldest
139-
// Index 1 will be the release prior to the most recent release
140-
const lastRelease = supported[1]
141-
const previousDirName = existingDataDir.filter((directory) => directory.includes(lastRelease))
142-
143-
console.log(
144-
`Copying src/${pipeline}/data/${previousDirName} to src/${pipeline}/data/${dirToAdd}`,
145-
)
146-
await cp(`src/${pipeline}/data/${previousDirName}`, `src/${pipeline}/data/${dirToAdd}`, {
147-
recursive: true,
148-
})
141+
// Find ALL directories to add for this base name (may be multiple
142+
// when a release has more than one calendar-date version).
143+
const dirsToAdd = addFiles.filter((item) => item.startsWith(base))
144+
for (const dirToAdd of dirsToAdd) {
145+
// Derive the previous release's corresponding directory by replacing
146+
// the current release number with the previous one. This correctly
147+
// maps each calendar-date variant to its predecessor, e.g.:
148+
// ghes-3.20-2022-11-28 → ghes-3.19-2022-11-28
149+
// ghes-3.20-2026-03-10 → ghes-3.19-2026-03-10
150+
const previousDirName = dirToAdd.replace(currentReleaseNumber, previousReleaseNumber)
151+
if (!existingDataDir.includes(previousDirName)) {
152+
throw new Error(
153+
`Cannot find previous release directory '${previousDirName}' to copy from ` +
154+
`when creating '${dirToAdd}' in src/${pipeline}/data/.`,
155+
)
156+
}
157+
158+
console.log(
159+
`Copying src/${pipeline}/data/${previousDirName} to src/${pipeline}/data/${dirToAdd}`,
160+
)
161+
await cp(`src/${pipeline}/data/${previousDirName}`, `src/${pipeline}/data/${dirToAdd}`, {
162+
recursive: true,
163+
})
164+
}
149165
}
150166
}
151167

‎src/rest/scripts/update-files.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { allVersions } from '@/versions/lib/all-versions'
2121
import { syncWebhookData } from '../../webhooks/scripts/sync'
2222
import { syncGitHubAppsData } from '../../github-apps/scripts/sync'
2323
import { syncRestRedirects } from './utils/get-redirects'
24+
import { syncChangelogs } from './utils/sync-changelogs'
2425
import { MODELS_GATEWAY_ROOT, injectModelsSchema } from './utils/inject-models-schema'
2526

2627
const __dirname = path.dirname(fileURLToPath(import.meta.url))
@@ -130,6 +131,7 @@ async function main() {
130131
if (pipelines.includes('rest')) {
131132
console.log(`\n▶️ Generating REST data files...\n`)
132133
await syncRestData(TEMP_OPENAPI_DIR, restSchemas, sourceRepoDirectory, injectModelsSchema)
134+
await syncChangelogs(sourceRepoDirectory, VERSION_NAMES)
133135
}
134136

135137
if (pipelines.includes('webhooks')) {
Lines changed: 190 additions & 0 deletions

0 commit comments

Comments
 (0)