Skip to content

Repo sync #27609

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 2 commits into from
Aug 21, 2023
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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
// one has ability to clone the remote (private) translations
// repos.
// You can run multiple paths per suite as space-separated in `path`.
// Note that *if you add* to this, remember to also add that
// to the **required checks** in the branch protection rules.
return [
{ name: 'automated-pipelines', path: 'src/automated-pipelines/tests', },
{ name: 'content', path: 'tests/content', },
Expand Down
12 changes: 12 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,15 @@ Check the README.md in the subject folder for questions specific to a subject.
For internal folks, please ask in the Docs Engineering Slack or repository.

For open source folks, please ask on the [discussion board](https://github.com/github/docs/discussions).

## A note on tests and required checks

Most subject folders have their own mention in `.github/workflows/test.yml`.
Open the file to see the beginning of it. It's manually maintained but
it's important to point out two things:

1. It's manually entered so creating a `src/foo/tests/*.js` doesn't
automatically start running those tests.
1. When you add an entry to `.github/workflows/test.yml`, and it's
gone into `main`, don't forget to add it to the branch protection's
required checks.
24 changes: 24 additions & 0 deletions src/learning-track/middleware/learning-track.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@ export default async function learningTrack(req, res, next) {

let trackProduct = req.context.currentProduct
const allLearningTracks = getDeepDataByLanguage('learning-tracks', req.language)
if (req.langauge !== 'en') {
// Don't trust the `.guides` from the translation. It too often has
// broken Liquid (e.g. `{% ifversion fpt 또는 ghec 또는 ghes %}`)
const allEnglishLearningTracks = getDeepDataByLanguage('learning-tracks', 'en')
for (const [key, tracks] of Object.entries(allLearningTracks)) {
if (!(key in allEnglishLearningTracks)) {
// This can happen when the translation of
// `data/learning-tracks/foo.yml` has stuff in it that the English
// content no longer has. In that case, just skip it.
delete allLearningTracks[key]
console.warn('No English learning track for %s', key)
continue
}
for (const [name, track] of Object.entries(tracks)) {
// If this individual track does no longer exist in English,
// delete it from the translation too.
if (!(name in allEnglishLearningTracks[key])) {
delete tracks[name]
continue
}
track.guides = allEnglishLearningTracks[key][name].guides
}
}
}
let tracksPerProduct = allLearningTracks[trackProduct]

// If there are no learning tracks for the current product, try and fall
Expand Down