forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into issue-22492
- Loading branch information
Showing
11,912 changed files
with
467,197 additions
and
8,792,075 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
.github/actions-scripts/purge-fastly-edge-cache-per-language.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env node | ||
|
||
import { languageKeys } from '../../lib/languages.js' | ||
|
||
import { makeLanguageSurrogateKey } from '../../middleware/set-fastly-surrogate-key.js' | ||
import purgeEdgeCache from '../../script/deployment/purge-edge-cache.js' | ||
|
||
// This covers things like `/api/webhooks` which isn't language specific. | ||
await purgeEdgeCache(makeLanguageSurrogateKey()) | ||
|
||
const languages = process.env.LANGUAGES | ||
? languagesFromString(process.env.LANGUAGES) | ||
: // Make sure `en` is first because contributors write mostly in English | ||
// and they're most likely wanting to see their landed changes appear | ||
// in production as soon as possible. | ||
languageKeys.sort((a) => (a === 'en' ? -1 : 1)) | ||
|
||
for (const language of languages) { | ||
await purgeEdgeCache(makeLanguageSurrogateKey(language)) | ||
} | ||
|
||
function languagesFromString(str) { | ||
const languages = str | ||
.split(/,/) | ||
.map((x) => x.trim()) | ||
.filter(Boolean) | ||
if (!languages.every((lang) => languageKeys.includes(lang))) { | ||
throw new Error( | ||
`Unrecognized language code (${languages.find((lang) => !languageKeys.includes(lang))})` | ||
) | ||
} | ||
return languages | ||
} |
Oops, something went wrong.