Skip to content

Commit 370e376

Browse files
authored
Merge pull request #22529 from github/repo-sync
repo sync
2 parents 49d8cdc + 1ce9697 commit 370e376

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

.github/actions-scripts/purge-fastly-edge-cache.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import { SURROGATE_ENUMS } from '../../middleware/set-fastly-surrogate-key.js'
33
import purgeEdgeCache from '../../script/deployment/purge-edge-cache.js'
44

5-
// This will purge every response that *contains* `SURROGATE_ENUMS.DEFAULT`.
5+
// This will purge every response that *contains*
6+
// `process.env.FASTLY_SURROGATE_KEY || SURROGATE_ENUMS.DEFAULT`.
67
// We normally send Surrogate-Key values like:
78
//
89
// every-deployment language:en
@@ -17,4 +18,4 @@ import purgeEdgeCache from '../../script/deployment/purge-edge-cache.js'
1718
//
1819
// It will cover all surrogate keys that contain that.
1920
// So this the nuclear option for all keys with this prefix.
20-
await purgeEdgeCache(SURROGATE_ENUMS.DEFAULT)
21+
await purgeEdgeCache(process.env.FASTLY_SURROGATE_KEY || SURROGATE_ENUMS.DEFAULT)

.github/workflows/sync-search-elasticsearch.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ env:
3535
FREEZE: ${{ secrets.FREEZE }}
3636
ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }}
3737

38+
# This might seem a bit strange, but it's clever. Since this action
39+
# uses a matrix to deal with one language at a time, we can use this
40+
# to pretend it's always the same directory.
41+
TRANSLATIONS_ROOT_ES_ES: translation
42+
TRANSLATIONS_ROOT_ZH_CN: translation
43+
TRANSLATIONS_ROOT_JA_JP: translation
44+
TRANSLATIONS_ROOT_PT_BR: translation
45+
TRANSLATIONS_ROOT_FR_FR: translation
46+
TRANSLATIONS_ROOT_RU_RU: translation
47+
TRANSLATIONS_ROOT_KO_KR: translation
48+
TRANSLATIONS_ROOT_DE_DE: translation
49+
3850
jobs:
3951
figureOutMatrix:
4052
runs-on: ubuntu-latest
@@ -98,6 +110,14 @@ jobs:
98110
- name: Check out repo
99111
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
100112

113+
- name: Checkout the non-English repo
114+
if: ${{ matrix.language != 'en' }}
115+
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
116+
with:
117+
repository: github/docs-internal.${{ fromJSON('{"cn":"zh-cn","es":"es-es","ru":"ru-ru","ja":"ja-jp","pt":"pt-br","de":"de-de","fr":"fr-fr","ko":"ko-kr"}')[matrix.language] }}
118+
token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
119+
path: translation
120+
101121
- name: Setup Node
102122
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048
103123
with:

script/deployment/purge-edge-cache.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,29 @@ const DELAY_BEFORE_SECOND_PURGE = 30 * 1000
1616
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
1717

1818
async function purgeFastlyBySurrogateKey({ apiToken, serviceId, surrogateKey }) {
19-
const key = surrogateKey
2019
const safeServiceId = encodeURIComponent(serviceId)
2120

2221
const headers = {
2322
'fastly-key': apiToken,
2423
accept: 'application/json',
2524
'fastly-soft-purge': '1',
2625
}
27-
const requestPath = `https://api.fastly.com/service/${safeServiceId}/purge/${key}`
26+
const requestPath = `https://api.fastly.com/service/${safeServiceId}/purge/${surrogateKey}`
2827
return got.post(requestPath, { headers, json: true })
2928
}
3029

3130
export default async function purgeEdgeCache(
32-
key,
31+
surrogateKey,
3332
{
3433
purgeTwice = true,
3534
delayBeforeFirstPurge = DELAY_BEFORE_FIRST_PURGE,
3635
delayBeforeSecondPurge = DELAY_BEFORE_SECOND_PURGE,
3736
} = {}
3837
) {
39-
const surrogateKey = key || process.env.FASTLY_SURROGATE_KEY
4038
if (!surrogateKey) {
4139
throw new Error('No key set and/or no FASTLY_SURROGATE_KEY env var set')
4240
}
43-
console.log(`Fastly purgeEdgeCache initialized for ${surrogateKey}...`)
41+
console.log(`Fastly purgeEdgeCache initialized for: '${surrogateKey}'`)
4442

4543
const { FASTLY_TOKEN, FASTLY_SERVICE_ID } = process.env
4644
if (!FASTLY_TOKEN || !FASTLY_SERVICE_ID) {

0 commit comments

Comments
 (0)