Skip to content

Commit 04ad93f

Browse files
authored
Merge branch 'main' into fix-graphql-scopes
2 parents f056629 + 76d7749 commit 04ad93f

File tree

3,477 files changed

+54502
-1319825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,477 files changed

+54502
-1319825
lines changed

.github/actions-scripts/msft-create-translation-batch-pr.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env node
22

3-
import fs from 'fs'
43
import github from '@actions/github'
54

65
const OPTIONS = Object.fromEntries(
@@ -33,7 +32,6 @@ const {
3332
BASE,
3433
HEAD,
3534
LANGUAGE,
36-
BODY_FILE,
3735
GITHUB_TOKEN,
3836
} = OPTIONS
3937
const [OWNER, REPO] = GITHUB_REPOSITORY.split('/')
@@ -121,7 +119,7 @@ async function main() {
121119
title: TITLE,
122120
base: BASE,
123121
head: HEAD,
124-
body: fs.readFileSync(BODY_FILE, 'utf8'),
122+
body: `New translation batch for ${LANGUAGE}. You can see the log in [\`translations/log/${LANGUAGE}-resets.csv\`](https://github.com/${OWNER}/${REPO}/tree/${HEAD}/translations/log/${LANGUAGE}-resets.csv).`,
125123
labels: ['translation-batch', `translation-batch-${LANGUAGE}`],
126124
owner: OWNER,
127125
repo: REPO,

.github/actions-scripts/prune-for-preview-env.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ mkdir translations
1919
# need these legacy redirects. Only the redirects from
2020
# front-matter will be at play.
2121
# These static redirects json files are notoriously large
22-
echo '[]' > lib/redirects/static/archived-frontmatter-fallbacks.json
22+
echo '[]' > lib/redirects/static/archived-frontmatter-valid-urls.json
2323
echo '{}' > lib/redirects/static/archived-redirects-from-213-to-217.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Dry run Elasticsearch indexing
2+
3+
# **What it does**: Tests to index records into a local Elasticsearch
4+
# **Why we have it**: To make sure the indexing code works.
5+
# **Who does it impact**: Docs engineering.
6+
7+
on:
8+
push:
9+
branches:
10+
- gh-readonly-queue/main/**
11+
pull_request:
12+
paths:
13+
- script/search/index-elasticsearch.mjs
14+
- 'package*.json'
15+
- .github/workflows/dry-run-elasticsearch-indexing.yml
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
dry-run-elasticsearch-indexing:
22+
# Avoid github/docs and forks of it
23+
if: github.repository == 'github/docs-internal'
24+
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: getong/elasticsearch-action@95b501ab0c83dee0aac7c39b7cea3723bef14954
29+
with:
30+
elasticsearch version: '8.2.0'
31+
host port: 9200
32+
container port: 9200
33+
host node port: 9300
34+
node port: 9300
35+
discovery type: 'single-node'
36+
37+
- name: Checkout
38+
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
39+
with:
40+
lfs: 'true'
41+
42+
- name: Check out LFS objects
43+
run: git lfs checkout
44+
45+
- name: Setup node
46+
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561
47+
with:
48+
node-version: 16.15.x
49+
cache: npm
50+
51+
- name: Install
52+
run: npm ci
53+
54+
# Serves two purposes;
55+
# 1. Be confident that the Elasticsearch server start-up worked at all
56+
# 2. Sometimes Elasticsearch will bind to the port but still not
57+
# technically be ready. By using `curl --retry` we can know it's
58+
# also genuinely ready to use.
59+
- name: Ping Elasticsearch
60+
run: curl --retry-connrefused --retry 5 -I http://localhost:9200/
61+
62+
- name: Index some
63+
env:
64+
ELASTICSEARCH_URL: 'http://localhost:9200'
65+
run: |
66+
./script/search/index-elasticsearch.mjs --verbose \
67+
-l en -l ja \
68+
-V dotcom -V ghes-3.5
69+
70+
- name: Show created indexes and aliases
71+
run: |
72+
curl http://localhost:9200/_cat/indices?v
73+
curl http://localhost:9200/_cat/aliases?v

.github/workflows/msft-create-translation-batch-pr.yml

+38-17
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,47 @@ jobs:
3030
max-parallel: 1
3131
matrix:
3232
include:
33-
# TODO: replace language_repos with actual repos once created
34-
# - language: pt
35-
# crowdin_language: pt-BR
36-
# language_dir: translations/pt-BR
37-
# language_repo: github/docs-translations-pt-br
38-
3933
- language: es
4034
crowdin_language: es-ES
4135
language_dir: translations/es-ES
42-
language_repo: github/docs-localization-test-es-es
43-
44-
# - language: cn
45-
# crowdin_language: zh-CN
46-
# language_dir: translations/zh-CN
47-
# language_repo: github/docs-translations-zh-cn
48-
49-
# - language: ja
50-
# crowdin_language: ja
51-
# language_dir: translations/ja-JP
52-
# language_repo: github/docs-translations-ja-jp
36+
language_repo: github/docs-internal.es-es
37+
38+
- language: ja
39+
crowdin_language: ja-JP
40+
language_dir: translations/ja-JP
41+
language_repo: github/docs-internal.ja-jp
42+
43+
- language: pt
44+
crowdin_language: pt-BR
45+
language_dir: translations/pt-BR
46+
language_repo: github/docs-internal.pt-br
47+
48+
- language: cn
49+
crowdin_language: zh-CN
50+
language_dir: translations/zh-CN
51+
language_repo: github/docs-internal.zh-cn
52+
53+
# We'll be ready to add the following languages in a future effort.
54+
55+
# - language: ru
56+
# crowdin_language: ru-RU
57+
# language_dir: translations/ru-RU
58+
# language_repo: github/docs-internal.ru-ru
59+
60+
# - language: ko
61+
# crowdin_language: ko-KR
62+
# language_dir: translations/ko-KR
63+
# language_repo: github/docs-internal.ko-kr
64+
65+
# - language: fr
66+
# crowdin_language: fr-FR
67+
# language_dir: translations/fr-FR
68+
# language_repo: github/docs-internal.fr-fr
69+
70+
# - language: de
71+
# crowdin_language: de-DE
72+
# language_dir: translations/de-DE
73+
# language_repo: github/docs-internal.de-de
5374

5475
# TODO: replace the branch name
5576
steps:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ When using the GitHub logos, be sure to follow the [GitHub logo guidelines](http
6060

6161
## Thanks :purple_heart:
6262

63-
Thanks for all your contributions and efforts towards improving the GitHub documentation. We thank you being part of our :sparkles: community :sparkles:!
63+
Thanks for all your contributions and efforts towards improving the GitHub documentation. We thank you for being part of our :sparkles: community :sparkles:!
Loading
Loading
32.2 KB
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

components/Search.tsx

+87-69
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import React, { useState, useEffect, useRef, ReactNode, RefObject } from 'react'
22
import { useRouter } from 'next/router'
33
import useSWR from 'swr'
44
import cx from 'classnames'
5-
import { ActionList, DropdownMenu, Flash, Label } from '@primer/react'
6-
import { ItemInput } from '@primer/react/lib/ActionList/List'
5+
import { Flash, Label, ActionList, ActionMenu } from '@primer/react'
6+
import { ItemInput } from '@primer/react/lib/deprecated/ActionList/List'
7+
import { InfoIcon } from '@primer/octicons-react'
78

89
import { useTranslation } from 'components/hooks/useTranslation'
910
import { sendEvent, EventType } from 'components/lib/events'
@@ -323,12 +324,13 @@ function ShowSearchResults({
323324
debug: boolean
324325
query: string
325326
}) {
326-
const { t } = useTranslation('search')
327+
const { t } = useTranslation(['pages', 'search'])
327328
const router = useRouter()
328329
const { currentVersion } = useVersion()
329330
const { allVersions } = useMainContext()
330331
const searchVersion = allVersions[currentVersion].versionTitle
331332
const [selectedVersion, setSelectedVersion] = useState<ItemInput | undefined>()
333+
const currentVersionPathSegment = currentVersion === DEFAULT_VERSION ? '' : `/${currentVersion}`
332334

333335
const latestVersions = new Set(
334336
Object.keys(allVersions)
@@ -397,12 +399,32 @@ function ShowSearchResults({
397399
>
398400
Select version:
399401
</p>
400-
<DropdownMenu
401-
placeholder={searchVersion}
402-
items={searchVersions}
403-
selectedItem={selectedVersion}
404-
onChange={setSelectedVersion}
405-
/>
402+
<ActionMenu>
403+
<ActionMenu.Button sx={{ display: 'inline-block' }}>
404+
{selectedVersion ? selectedVersion.text : searchVersion}
405+
</ActionMenu.Button>
406+
<ActionMenu.Overlay>
407+
<ActionList selectionVariant="single">
408+
{searchVersions.map((searchVersion) => {
409+
return (
410+
<ActionList.Item
411+
onSelect={() => setSelectedVersion(searchVersion)}
412+
key={searchVersion.key}
413+
>
414+
{searchVersion.text}
415+
</ActionList.Item>
416+
)
417+
})}
418+
419+
<ActionList.LinkItem
420+
className="f6"
421+
href={`/${router.locale}${currentVersionPathSegment}/get-started/learning-about-github/about-versions-of-github-docs`}
422+
>
423+
{t('about_versions')} <InfoIcon />
424+
</ActionList.LinkItem>
425+
</ActionList>
426+
</ActionMenu.Overlay>
427+
</ActionMenu>
406428
</div>
407429
</div>
408430
{/* We might have results AND isLoading. For example, the user typed
@@ -419,67 +441,63 @@ function ShowSearchResults({
419441
{t('matches_displayed')}: {results.length === 0 ? t('no_results') : results.length}
420442
</p>
421443

422-
<ActionList
423-
items={results.map(({ url, breadcrumbs, title, content, score, popularity }) => {
424-
return {
425-
key: url,
426-
text: title,
427-
renderItem: () => (
428-
<ActionList.Item as="div">
429-
<Link href={url} className="no-underline color-fg-default">
430-
<li
431-
data-testid="search-result"
432-
className={cx('list-style-none', styles.resultsContainer)}
433-
>
434-
<div className={cx('py-2 px-3')}>
435-
{/* Breadcrumbs in search records don't include the page title. These fields may contain <mark> elements that we need to render */}
436-
<Label variant="small" sx={{ bg: 'accent.emphasis' }}>
437-
{breadcrumbs.length === 0
438-
? title.replace(/<\/?[^>]+(>|$)|(\/)/g, '')
439-
: breadcrumbs
440-
.split(' / ')
441-
.slice(0, 1)
442-
.join(' ')
443-
.replace(/<\/?[^>]+(>|$)|(\/)/g, '')}
444-
</Label>
445-
{debug && (
446-
<small className="float-right">
447-
score: {score.toFixed(4)} popularity: {popularity.toFixed(4)}
448-
</small>
449-
)}
450-
<h2
451-
className={cx('mt-2 text-normal f3 d-block')}
452-
dangerouslySetInnerHTML={{
453-
__html: title,
454-
}}
455-
/>
456-
<div
457-
className={cx(styles.searchResultContent, 'mt-1 d-block overflow-hidden')}
458-
style={{ maxHeight: '2.5rem' }}
459-
dangerouslySetInnerHTML={{ __html: content }}
460-
/>
461-
<div
462-
className={'d-block mt-2 opacity-70 text-small'}
463-
dangerouslySetInnerHTML={
464-
breadcrumbs.length === 0
465-
? { __html: `${title}`.replace(/<\/?[^>]+(>|$)|(\/)/g, '') }
466-
: {
467-
__html: breadcrumbs
468-
.split(' / ')
469-
.slice(0, breadcrumbs.length - 1)
470-
.join(' / ')
471-
.replace(/<\/?[^>]+(>|$)/g, ''),
472-
}
473-
}
474-
/>
475-
</div>
476-
</li>
477-
</Link>
478-
</ActionList.Item>
479-
),
480-
}
444+
<ActionList variant="full">
445+
{results.map(({ url, breadcrumbs, title, content, score, popularity }) => {
446+
return (
447+
<ActionList.Item className="width-full" key={url}>
448+
<Link href={url} className="no-underline color-fg-default">
449+
<div
450+
data-testid="search-result"
451+
className={cx('list-style-none', styles.resultsContainer)}
452+
>
453+
<div className={cx('py-2 px-3')}>
454+
{/* Breadcrumbs in search records don't include the page title. These fields may contain <mark> elements that we need to render */}
455+
<Label size="small" variant="accent">
456+
{breadcrumbs.length === 0
457+
? title.replace(/<\/?[^>]+(>|$)|(\/)/g, '')
458+
: breadcrumbs
459+
.split(' / ')
460+
.slice(0, 1)
461+
.join(' ')
462+
.replace(/<\/?[^>]+(>|$)|(\/)/g, '')}
463+
</Label>
464+
{debug && (
465+
<small className="float-right">
466+
score: {score.toFixed(4)} popularity: {popularity.toFixed(4)}
467+
</small>
468+
)}
469+
<h2
470+
className={cx('mt-2 text-normal f3 d-block')}
471+
dangerouslySetInnerHTML={{
472+
__html: title,
473+
}}
474+
/>
475+
<div
476+
className={cx(styles.searchResultContent, 'mt-1 d-block overflow-hidden')}
477+
style={{ maxHeight: '2.5rem' }}
478+
dangerouslySetInnerHTML={{ __html: content }}
479+
/>
480+
<div
481+
className={'d-block mt-2 opacity-70 text-small'}
482+
dangerouslySetInnerHTML={
483+
breadcrumbs.length === 0
484+
? { __html: `${title}`.replace(/<\/?[^>]+(>|$)|(\/)/g, '') }
485+
: {
486+
__html: breadcrumbs
487+
.split(' / ')
488+
.slice(0, breadcrumbs.length - 1)
489+
.join(' / ')
490+
.replace(/<\/?[^>]+(>|$)/g, ''),
491+
}
492+
}
493+
/>
494+
</div>
495+
</div>
496+
</Link>
497+
</ActionList.Item>
498+
)
481499
})}
482-
/>
500+
</ActionList>
483501
</div>
484502
)
485503
return <div>{ActionListResults}</div>

components/article/PlatformPicker.tsx

-11
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,7 @@ export const PlatformPicker = ({ variant = 'subnav' }: Props) => {
135135
<UnderlineNav.Link
136136
key={option.id}
137137
data-platform={option.id}
138-
as="button"
139138
selected={option.id === currentPlatform}
140-
// Temporary fix: This should be removed when this merges: PR 24123
141-
sx={{
142-
color: 'var(--color-fg-default)',
143-
'&.selected': { color: 'var(--color-fg-default)' },
144-
':hover': { color: 'var(--color-fg-default)' },
145-
':focus': {
146-
color: 'var(--color-fg-default)',
147-
outline: '-webkit-focus-ring-color auto 1px;',
148-
},
149-
}}
150139
onClick={() => {
151140
onClickPlatform(option.id)
152141
}}

0 commit comments

Comments
 (0)