Skip to content

Commit b034d33

Browse files
authored
Branch was updated using the 'autoupdate branch' Actions workflow.
2 parents bf23391 + 4a76141 commit b034d33

File tree

4 files changed

+66
-26
lines changed

4 files changed

+66
-26
lines changed

data/glossaries/external.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
- term: bio
3838
description: >-
3939
The user-generated description found on a profile:
40-
https://help.github.com/articles/adding-a-bio-to-your-profile/
40+
[Adding a bio to your profile](/articles/adding-a-bio-to-your-profile)
4141
- term: billing cycle
4242
description: The interval of time for your specific billing plan.
4343
- term: billing email
@@ -160,8 +160,8 @@
160160
- term: contributions
161161
description: >-
162162
Specific activities on GitHub that will:
163-
- Add a square to a user's contribution graph: "[What counts as a contribution](https://help.github.com/articles/viewing-contributions-on-your-profile/#what-counts-as-a-contribution)"
164-
- Add activities to a user's timeline on their profile: "[Contribution activity](https://help.github.com/articles/viewing-contributions-on-your-profile/#contribution-activity)"
163+
- Add a square to a user's contribution graph: "[What counts as a contribution](/articles/viewing-contributions-on-your-profile/#what-counts-as-a-contribution)"
164+
- Add activities to a user's timeline on their profile: "[Contribution activity](/articles/viewing-contributions-on-your-profile/#contribution-activity)"
165165
- term: contributor
166166
description: >-
167167
A contributor is someone who does not have collaborator access to a repository but has contributed to a project and had a pull request they opened merged into the repository.
@@ -230,7 +230,7 @@
230230
description: >-
231231
A branch used to experiment with a new feature or fix an issue that is not in production. Also called a topic branch.
232232
- term: fenced code block
233-
description: An indented block of code you can create with GitHub Flavored Markdown using triple backticks \`\`\` before and after the code block. See this [example](https://help.github.com/en/articles/creating-and-highlighting-code-blocks#fenced-code-blocks).
233+
description: An indented block of code you can create with GitHub Flavored Markdown using triple backticks \`\`\` before and after the code block. See this [example](/articles/creating-and-highlighting-code-blocks#fenced-code-blocks).
234234
- term: fetch
235235
description: >-
236236
When you use `git fetch`, you're adding changes from the remote repository to

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"test": "jest && eslint . && prettier -c \"**/*.{yml,yaml}\" && npm run check-deps",
162162
"prebrowser-test": "npm run build",
163163
"browser-test": "start-server-and-test browser-test-server 4001 browser-test-tests",
164-
"browser-test-server": "cross-env NODE_ENV=production ENABLED_LANGUAGES='en,ja' PORT=4001 node server.js",
164+
"browser-test-server": "cross-env NODE_ENV=production PORT=4001 node server.js",
165165
"browser-test-tests": "cross-env BROWSER=1 jest tests/browser/browser.js",
166166
"sync-search": "start-server-and-test sync-search-server 4002 sync-search-indices",
167167
"sync-search-dry-run": "DRY_RUN=1 npm run sync-search",

tests/browser/browser.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* global page, browser */
22
const sleep = require('await-sleep')
33
const { latest } = require('../../lib/enterprise-server-releases')
4+
const languages = require('../../lib/languages')
45

56
describe('homepage', () => {
67
jest.setTimeout(60 * 1000)
@@ -264,3 +265,19 @@ describe('card filters', () => {
264265
expect(noResultsClasses).not.toContain('d-none')
265266
})
266267
})
268+
269+
describe('language banner', () => {
270+
it('directs user to the English version of the article', async () => {
271+
const wipLanguageKey = Object.keys(languages).find(key => languages[key].wip)
272+
273+
// This kinda sucks, but if we don't have a WIP language, we currently can't
274+
// run a reliable test. But hey, on the bright side, if we don't have a WIP
275+
// language then this code will never run anyway!
276+
if (wipLanguageKey) {
277+
const res = await page.goto(`http://localhost:4001/${wipLanguageKey}/actions`)
278+
expect(res.ok()).toBe(true)
279+
const href = await page.$eval('a#to-english-doc', el => el.href)
280+
expect(href.endsWith('/en/actions')).toBe(true)
281+
}
282+
})
283+
})

tests/content/lint-files.js

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const rootDir = path.join(__dirname, '../..')
1717
const contentDir = path.join(rootDir, 'content')
1818
const reusablesDir = path.join(rootDir, 'data/reusables')
1919
const variablesDir = path.join(rootDir, 'data/variables')
20+
const glossariesDir = path.join(rootDir, 'data/glossaries')
2021

2122
const languageCodes = Object.keys(languages)
2223

@@ -320,7 +321,19 @@ describe('lint-files', () => {
320321
const variableYamlRelPaths = variableYamlAbsPaths.map(p => slash(path.relative(rootDir, p)))
321322
const variableYamlTuples = zip(variableYamlRelPaths, variableYamlAbsPaths)
322323

323-
describe.each(variableYamlTuples)(
324+
const glossariesYamlAbsPaths = walk(glossariesDir, yamlWalkOptions).sort()
325+
const glossariesYamlRelPaths = glossariesYamlAbsPaths.map(p => slash(path.relative(rootDir, p)))
326+
const glossariesYamlTuples = zip(glossariesYamlRelPaths, glossariesYamlAbsPaths)
327+
328+
// Returns `content` if its a string, or `content.description` if it can.
329+
// Used for getting the nested `description` key in glossary files.
330+
function getContent (content) {
331+
if (typeof content === 'string') return content
332+
if (typeof content.description === 'string') return content.description
333+
return null
334+
}
335+
336+
describe.each([...variableYamlTuples, ...glossariesYamlTuples])(
324337
'in "%s"',
325338
(yamlRelPath, yamlAbsPath) => {
326339
let dictionary, isEarlyAccess
@@ -336,8 +349,9 @@ describe('lint-files', () => {
336349
const matches = []
337350

338351
for (const [key, content] of Object.entries(dictionary)) {
339-
if (typeof content !== 'string') continue
340-
const valMatches = (content.match(relativeArticleLinkRegex) || [])
352+
const contentStr = getContent(content)
353+
if (!contentStr) continue
354+
const valMatches = (contentStr.match(relativeArticleLinkRegex) || [])
341355
if (valMatches.length > 0) {
342356
matches.push(...valMatches.map((match) => `Key "${key}": ${match}`))
343357
}
@@ -351,8 +365,9 @@ describe('lint-files', () => {
351365
const matches = []
352366

353367
for (const [key, content] of Object.entries(dictionary)) {
354-
if (typeof content !== 'string') continue
355-
const valMatches = (content.match(languageLinkRegex) || [])
368+
const contentStr = getContent(content)
369+
if (!contentStr) continue
370+
const valMatches = (contentStr.match(languageLinkRegex) || [])
356371
if (valMatches.length > 0) {
357372
matches.push(...valMatches.map((match) => `Key "${key}": ${match}`))
358373
}
@@ -366,8 +381,9 @@ describe('lint-files', () => {
366381
const matches = []
367382

368383
for (const [key, content] of Object.entries(dictionary)) {
369-
if (typeof content !== 'string') continue
370-
const valMatches = (content.match(versionLinkRegEx) || [])
384+
const contentStr = getContent(content)
385+
if (!contentStr) continue
386+
const valMatches = (contentStr.match(versionLinkRegEx) || [])
371387
if (valMatches.length > 0) {
372388
matches.push(...valMatches.map((match) => `Key "${key}": ${match}`))
373389
}
@@ -381,8 +397,9 @@ describe('lint-files', () => {
381397
const matches = []
382398

383399
for (const [key, content] of Object.entries(dictionary)) {
384-
if (typeof content !== 'string') continue
385-
const valMatches = (content.match(domainLinkRegex) || [])
400+
const contentStr = getContent(content)
401+
if (!contentStr) continue
402+
const valMatches = (contentStr.match(domainLinkRegex) || [])
386403
if (valMatches.length > 0) {
387404
matches.push(...valMatches.map((match) => `Key "${key}": ${match}`))
388405
}
@@ -398,8 +415,9 @@ describe('lint-files', () => {
398415
const matches = []
399416

400417
for (const [key, content] of Object.entries(dictionary)) {
401-
if (typeof content !== 'string') continue
402-
const valMatches = (content.match(earlyAccessLinkRegex) || [])
418+
const contentStr = getContent(content)
419+
if (!contentStr) continue
420+
const valMatches = (contentStr.match(earlyAccessLinkRegex) || [])
403421
if (valMatches.length > 0) {
404422
matches.push(...valMatches.map((match) => `Key "${key}": ${match}`))
405423
}
@@ -416,8 +434,9 @@ describe('lint-files', () => {
416434
const matches = []
417435

418436
for (const [key, content] of Object.entries(dictionary)) {
419-
if (typeof content !== 'string') continue
420-
const valMatches = (content.match(earlyAccessImageRegex) || [])
437+
const contentStr = getContent(content)
438+
if (!contentStr) continue
439+
const valMatches = (contentStr.match(earlyAccessImageRegex) || [])
421440
if (valMatches.length > 0) {
422441
matches.push(...valMatches.map((match) => `Key "${key}": ${match}`))
423442
}
@@ -434,8 +453,9 @@ describe('lint-files', () => {
434453
const matches = []
435454

436455
for (const [key, content] of Object.entries(dictionary)) {
437-
if (typeof content !== 'string') continue
438-
const valMatches = (content.match(badEarlyAccessImageRegex) || [])
456+
const contentStr = getContent(content)
457+
if (!contentStr) continue
458+
const valMatches = (contentStr.match(badEarlyAccessImageRegex) || [])
439459
if (valMatches.length > 0) {
440460
matches.push(...valMatches.map((match) => `Key "${key}": ${match}`))
441461
}
@@ -449,8 +469,9 @@ describe('lint-files', () => {
449469
const matches = []
450470

451471
for (const [key, content] of Object.entries(dictionary)) {
452-
if (typeof content !== 'string') continue
453-
const valMatches = (content.match(oldVariableRegex) || [])
472+
const contentStr = getContent(content)
473+
if (!contentStr) continue
474+
const valMatches = (contentStr.match(oldVariableRegex) || [])
454475
if (valMatches.length > 0) {
455476
matches.push(...valMatches.map((match) => {
456477
const example = match
@@ -468,8 +489,9 @@ describe('lint-files', () => {
468489
const matches = []
469490

470491
for (const [key, content] of Object.entries(dictionary)) {
471-
if (typeof content !== 'string') continue
472-
const valMatches = (content.match(oldOcticonRegex) || [])
492+
const contentStr = getContent(content)
493+
if (!contentStr) continue
494+
const valMatches = (contentStr.match(oldOcticonRegex) || [])
473495
if (valMatches.length > 0) {
474496
matches.push(...valMatches.map((match) => `Key "${key}": ${match}`))
475497
}
@@ -483,8 +505,9 @@ describe('lint-files', () => {
483505
const matches = []
484506

485507
for (const [key, content] of Object.entries(dictionary)) {
486-
if (typeof content !== 'string') continue
487-
const valMatches = (content.match(oldExtendedMarkdownRegex) || [])
508+
const contentStr = getContent(content)
509+
if (!contentStr) continue
510+
const valMatches = (contentStr.match(oldExtendedMarkdownRegex) || [])
488511
if (valMatches.length > 0) {
489512
matches.push(...valMatches.map((match) => `Key "${key}": ${match}`))
490513
}

0 commit comments

Comments
 (0)