Skip to content

repo sync #16689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ An overview of some of the most common actions that are recorded as events in th
| Action | Description
|--------------------|---------------------
| `add_email` | Triggered when you {% ifversion not ghae %}[add a new email address](/articles/changing-your-primary-email-address){% else %}add a new email address{% endif %}.{% ifversion fpt or ghec %}
| `codespaces_trusted_repo_access_granted` | Triggered when you [allow the codespaces you create for a repository to access other repositories owned by your user account](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces.
| `codespaces_trusted_repo_access_revoked` | Triggered when you [disallow the codespaces you create for a repository to access other repositories owned by your user account](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces. {% endif %}
| `codespaces_trusted_repo_access_granted` | Triggered when you [allow the codespaces you create for a repository to access other repositories owned by your user account](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces).
| `codespaces_trusted_repo_access_revoked` | Triggered when you [disallow the codespaces you create for a repository to access other repositories owned by your user account](/github/developing-online-with-codespaces/managing-access-and-security-for-codespaces). {% endif %}
| `create` | Triggered when you create a new user account.{% ifversion not ghae %}
| `change_password` | Triggered when you change your password.
| `forgot_password` | Triggered when you ask for [a password reset](/articles/how-can-i-reset-my-password).{% endif %}
Expand Down
9 changes: 6 additions & 3 deletions lib/site-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ export default function loadSiteData() {
en: loadSiteDataFromDir(languages.en.dir),
}

// load and add other language data to siteData where keys match english keys,
// filling holes with english site data
const englishKeys = Object.keys(flat(siteData.en))
for (const language of Object.values(languages)) {
if (language.code === 'en') continue
const data = loadSiteDataFromDir(language.dir)
const keys = Object.keys(flat(data))
// First set the fallback, which might get used if not overridden
for (const key of englishKeys) {
set(siteData, `${language.code}.${key}`, get(data, key) || get(siteData.en, key))
set(siteData, `${language.code}.${key}`, get(siteData.en, key))
}
for (const key of keys) {
set(siteData, `${language.code}.${key}`, get(data, key))
}
}

Expand Down
15 changes: 1 addition & 14 deletions tests/content/site-data.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fileURLToPath } from 'url'
import path from 'path'
import { get, isPlainObject, has } from 'lodash-es'
import { get, isPlainObject } from 'lodash-es'
import flat from 'flat'
import walkSync from 'walk-sync'
import { ParseError } from 'liquidjs'
Expand Down Expand Up @@ -88,17 +88,4 @@ describe('siteData module (English)', () => {
)}`
expect(yamlReusables.length, message).toBe(0)
})

test('all non-English data has matching English data', async () => {
for (const languageCode of Object.keys(data)) {
if (languageCode === 'en') continue

const nonEnglishKeys = Object.keys(flat(data[languageCode]))
for (const key of nonEnglishKeys) {
if (!has(data.en, key)) {
throw new Error(`matching data not found for ${languageCode}.${key}`)
}
}
}
})
})