@@ -2,6 +2,7 @@ import path from 'path'
22
33import { readCompressedJsonFileFallback } from '@/frame/lib/read-json-file'
44import { getOpenApiVersion } from '@/versions/lib/all-versions'
5+ import { supported as supportedGhesReleases } from '@/versions/lib/enterprise-server-releases'
56import findPage from '@/frame/lib/find-page'
67import type { Context , Page } from '@/types'
78import type {
@@ -300,6 +301,7 @@ export async function filterAndUpdateGhesDataByAllowlistValues({
300301 auditLogPage,
301302 titleContext,
302303 globalFields = [ ] ,
304+ supportedGhesVersions = supportedGhesReleases ,
303305} : {
304306 eventsToCheck : RawAuditLogEventT [ ]
305307 allowListValue : string
@@ -308,9 +310,17 @@ export async function filterAndUpdateGhesDataByAllowlistValues({
308310 auditLogPage : string
309311 titleContext ?: TitleResolutionContext
310312 globalFields ?: string [ ]
313+ supportedGhesVersions ?: string [ ]
311314} ) {
312315 if ( ! currentGhesEvents ) currentGhesEvents = { }
313316
317+ // Upstream `audit-log-allowlists/data/schema.json` lags docs's deprecation
318+ // schedule, so events still list `ghes` keys for versions we've already
319+ // dropped from `supported` in `enterprise-server-releases.ts`. Without this
320+ // filter, the nightly sync would re-add `src/audit-logs/data/ghes-X.Y/`
321+ // dirs for those deprecated versions. See docs-engineering#6562.
322+ const supportedGhesVersionSet = new Set ( supportedGhesVersions )
323+
314324 const seenByGhesVersion = new Map ( )
315325 for ( const [ ghesVersion , events ] of Object . entries ( currentGhesEvents ) ) {
316326 if ( ! events [ auditLogPage ] ) continue
@@ -320,6 +330,7 @@ export async function filterAndUpdateGhesDataByAllowlistValues({
320330
321331 for ( const event of eventsToCheck ) {
322332 for ( const ghesVersion of Object . keys ( event . ghes ) ) {
333+ if ( ! supportedGhesVersionSet . has ( ghesVersion ) ) continue
323334 const ghesVersionAllowlists = event . ghes [ ghesVersion ] . _allowlists
324335 const fullGhesVersion = `ghes-${ ghesVersion } `
325336
0 commit comments