diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 857374b9d0bd..3be4e7bdab55 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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', }, diff --git a/src/README.md b/src/README.md index c373dcb4a75b..0ed0ac7617c9 100644 --- a/src/README.md +++ b/src/README.md @@ -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. diff --git a/src/learning-track/middleware/learning-track.js b/src/learning-track/middleware/learning-track.js index 7ccc772157ee..6d4b99d8a494 100644 --- a/src/learning-track/middleware/learning-track.js +++ b/src/learning-track/middleware/learning-track.js @@ -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