Skip to content

Commit 93736c9

Browse files
authored
Merge pull request #27609 from github/repo-sync
Repo sync
2 parents 89201a7 + 3461bde commit 93736c9

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
// one has ability to clone the remote (private) translations
4040
// repos.
4141
// You can run multiple paths per suite as space-separated in `path`.
42+
// Note that *if you add* to this, remember to also add that
43+
// to the **required checks** in the branch protection rules.
4244
return [
4345
{ name: 'automated-pipelines', path: 'src/automated-pipelines/tests', },
4446
{ name: 'content', path: 'tests/content', },

src/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,15 @@ Check the README.md in the subject folder for questions specific to a subject.
5151
For internal folks, please ask in the Docs Engineering Slack or repository.
5252

5353
For open source folks, please ask on the [discussion board](https://github.com/github/docs/discussions).
54+
55+
## A note on tests and required checks
56+
57+
Most subject folders have their own mention in `.github/workflows/test.yml`.
58+
Open the file to see the beginning of it. It's manually maintained but
59+
it's important to point out two things:
60+
61+
1. It's manually entered so creating a `src/foo/tests/*.js` doesn't
62+
automatically start running those tests.
63+
1. When you add an entry to `.github/workflows/test.yml`, and it's
64+
gone into `main`, don't forget to add it to the branch protection's
65+
required checks.

src/learning-track/middleware/learning-track.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,30 @@ export default async function learningTrack(req, res, next) {
1616

1717
let trackProduct = req.context.currentProduct
1818
const allLearningTracks = getDeepDataByLanguage('learning-tracks', req.language)
19+
if (req.langauge !== 'en') {
20+
// Don't trust the `.guides` from the translation. It too often has
21+
// broken Liquid (e.g. `{% ifversion fpt 또는 ghec 또는 ghes %}`)
22+
const allEnglishLearningTracks = getDeepDataByLanguage('learning-tracks', 'en')
23+
for (const [key, tracks] of Object.entries(allLearningTracks)) {
24+
if (!(key in allEnglishLearningTracks)) {
25+
// This can happen when the translation of
26+
// `data/learning-tracks/foo.yml` has stuff in it that the English
27+
// content no longer has. In that case, just skip it.
28+
delete allLearningTracks[key]
29+
console.warn('No English learning track for %s', key)
30+
continue
31+
}
32+
for (const [name, track] of Object.entries(tracks)) {
33+
// If this individual track does no longer exist in English,
34+
// delete it from the translation too.
35+
if (!(name in allEnglishLearningTracks[key])) {
36+
delete tracks[name]
37+
continue
38+
}
39+
track.guides = allEnglishLearningTracks[key][name].guides
40+
}
41+
}
42+
}
1943
let tracksPerProduct = allLearningTracks[trackProduct]
2044

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

0 commit comments

Comments
 (0)