Skip to content

Commit c7ac337

Browse files
authored
Merge branch 'main' into patch-2
2 parents 682aab8 + d782a66 commit c7ac337

File tree

196 files changed

+9502
-5532
lines changed

Some content is hidden

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

196 files changed

+9502
-5532
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111

1212
// Set *default* container specific settings.json values on container create.
13-
"settings": {
13+
"settings": {
1414
"terminal.integrated.shell.linux": "/bin/bash",
1515
"cSpell.language": ",en"
1616
},
@@ -34,8 +34,8 @@
3434
"forwardPorts": [4000],
3535

3636
// Use 'postCreateCommand' to run commands after the container is created.
37-
"postCreateCommand": "npm ci && npm run build",
38-
37+
"postCreateCommand": "git lfs pull && npm ci",
38+
3939
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
4040
"remoteUser": "node"
4141

.github/workflows/main-preview-docker-cache.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ concurrency:
2020

2121
jobs:
2222
build-and-push-nonprod-cache:
23+
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
2324
runs-on: ubuntu-latest
2425
timeout-minutes: 15
2526
env:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Stale check for issues or PRs with "needs SME" label
2+
3+
# **What it does**: Provides stale checks on issues/PRs that need SME(subject matter expert) review on open source docs repo.
4+
# **Why we have it**: In the open repo, we want we want frequent checks on issues/PRs that are waiting on SME review.
5+
# **Who does it impact**: Anyone working in the open repo.
6+
7+
on:
8+
schedule:
9+
- cron: '40 20 * * *' # Run each day at 20:40 UTC / 12:40 PST
10+
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
15+
jobs:
16+
stale_needs-sme:
17+
if: ${{ github.repository == 'github/docs'' }}
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/stale@7fb802b3079a276cf3c7e6ba9aa003c665b3f838
22+
with:
23+
only-labels: needs SME
24+
remove-stale-when-updated: true
25+
days-before-stale: 7 # adds stale label if no activity for 7 days
26+
stale-issue-message: 'This is a gentle bump for the docs team that this issue is waiting for technical review.'
27+
stale-issue-label: SME stale
28+
days-before-issue-close: -1 # never close
29+
stale-pr-message: 'This is a gentle bump for the docs team that this PR is waiting for technical review.'
30+
stale-pr-label: SME stale
31+
days-before-pr-close: -1 # never close
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Comment on adding "needs SME" label
2+
3+
# **What it does**: Comment on issues and pull requests when a "needs SME" label is added. SME = subject matter expert.
4+
# **Why we have it**: We want to manage our queue of issues and pull requests that need sme review.
5+
# **Who does it impact**: Everyone that works on docs or docs-internal.
6+
7+
on:
8+
issues:
9+
types: [labeled]
10+
pull_request_target:
11+
types: [labeled]
12+
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
17+
jobs:
18+
add-comment:
19+
if: ${{ github.repository == 'github/docs' && (github.event.label.name == 'needs SME' && github.event_name == 'issues' || github.event_name == 'pull_request_target') }}
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: peter-evans/create-or-update-comment@a35cf36e5301d70b76f316e867e7788a55a31dae
23+
with:
24+
issue-number: ${{ github.event.issue.number }}
25+
body: |
26+
Thanks for opening an issue! We've triaged this issue for technical review by a subject matter expert :eyes:
27+
- uses: peter-evans/create-or-update-comment@a35cf36e5301d70b76f316e867e7788a55a31dae
28+
with:
29+
issue-number: ${{ github.event.pull_request.number }}
30+
body: |
31+
Thanks for opening a pull request! We've triaged this issue for technical review by a subject matter expert :eyes:

.github/workflows/sync-search-indices.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ jobs:
7777
env:
7878
VERSION: ${{ github.event.inputs.version }}
7979
LANGUAGE: ${{ github.event.inputs.language }}
80+
# We don't want or need the changelog entries in this context.
81+
# Pages that display the content from these isn't included
82+
# in search index bodies anyway.
83+
CHANGELOG_DISABLED: true
84+
# If a reusable, or anything in the `data/*` directory is deleted
85+
# you might get a
86+
#
87+
# RenderError: Can't find the key 'site.data.reusables...' in the scope
88+
#
89+
# But that'll get fixed in the next translation pipeline. For now,
90+
# let's just accept an empty string instead.
91+
THROW_ON_EMPTY: false
8092
run: npm run sync-search
8193

8294
- name: Update private docs repository search indexes

.github/workflows/test.yml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
# The same array lives in test-windows.yml, so make any updates there too.
34-
test-group: [
34+
test-group:
35+
[
3536
content,
3637
graphql,
3738
meta,
3839
rendering,
3940
routing,
4041
unit,
41-
# linting,
42+
linting,
4243
translations,
4344
]
4445
steps:
@@ -47,7 +48,10 @@ jobs:
4748
- name: Check out repo
4849
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
4950
with:
50-
lfs: true
51+
# Not all test suites need the LFS files. So instead, we opt to
52+
# NOT clone them initially and instead, include them manually
53+
# only for the test groups that we know need the files.
54+
lfs: ${{ matrix.test-group == 'content' }}
5155
# Enables cloning the Early Access repo later with the relevant PAT
5256
persist-credentials: 'false'
5357

@@ -98,23 +102,25 @@ jobs:
98102
mv docs-early-access/data data/early-access
99103
rm -r docs-early-access
100104
105+
# This is necessary when LFS files where cloned but does nothing
106+
# if actions/checkout was run with `lfs:false`.
101107
- name: Checkout LFS objects
102108
run: git lfs checkout
103109

104-
# - name: Gather files changed
105-
# uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b
106-
# id: get_diff_files
107-
# with:
108-
# # So that `steps.get_diff_files.outputs.files` becomes
109-
# # a string like `foo.js path/bar.md`
110-
# output: ' '
110+
- name: Gather files changed
111+
uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b
112+
id: get_diff_files
113+
with:
114+
# So that `steps.get_diff_files.outputs.files` becomes
115+
# a string like `foo.js path/bar.md`
116+
output: ' '
111117

112-
# - name: Insight into changed files
113-
# run: |
118+
- name: Insight into changed files
119+
run: |
114120
115-
# # Must to do this because the list of files can be HUGE. Especially
116-
# # in a repo-sync when there are lots of translation files involved.
117-
# echo "${{ steps.get_diff_files.outputs.files }}" > get_diff_files.txt
121+
# Must to do this because the list of files can be HUGE. Especially
122+
# in a repo-sync when there are lots of translation files involved.
123+
echo "${{ steps.get_diff_files.outputs.files }}" > get_diff_files.txt
118124
119125
- name: Setup node
120126
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561
@@ -136,6 +142,6 @@ jobs:
136142

137143
- name: Run tests
138144
env:
139-
# DIFF_FILE: get_diff_files.txt
145+
DIFF_FILE: get_diff_files.txt
140146
CHANGELOG_CACHE_FILE_PATH: tests/fixtures/changelog-feed.json
141147
run: npm test -- tests/${{ matrix.test-group }}/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-15.3 KB
Binary file not shown.

components/context/MainContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export type MainContextT = {
124124

125125
status: number
126126
fullUrl: string
127+
isDotComAuthenticated: boolean
127128
}
128129

129130
export const getMainContext = (req: any, res: any): MainContextT => {
@@ -189,6 +190,7 @@ export const getMainContext = (req: any, res: any): MainContextT => {
189190
nonEnterpriseDefaultVersion: req.context.nonEnterpriseDefaultVersion,
190191
status: res.statusCode,
191192
fullUrl: req.protocol + '://' + req.get('host') + req.originalUrl,
193+
isDotComAuthenticated: Boolean(req.cookies.dotcom_user),
192194
}
193195
}
194196

components/page-header/Header.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import styles from './Header.module.scss'
1717

1818
export const Header = () => {
1919
const router = useRouter()
20-
const { relativePath, error } = useMainContext()
20+
const { isDotComAuthenticated, relativePath, error } = useMainContext()
2121
const { currentVersion } = useVersion()
2222
const { t } = useTranslation(['header', 'homepage'])
2323
const [isMenuOpen, setIsMenuOpen] = useState(
@@ -26,7 +26,8 @@ export const Header = () => {
2626
const [scroll, setScroll] = useState(false)
2727

2828
const signupCTAVisible =
29-
currentVersion === 'free-pro-team@latest' || currentVersion === 'enterprise-cloud@latest'
29+
!isDotComAuthenticated &&
30+
(currentVersion === 'free-pro-team@latest' || currentVersion === 'enterprise-cloud@latest')
3031

3132
useEffect(() => {
3233
function onScroll() {

components/rest/PreviewsRow.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import { useTranslation } from 'components/hooks/useTranslation'
33

44
type Props = {
55
slug: string
6-
hasRequiredPreviews: boolean
76
xGitHub: xGitHub
87
}
98

10-
export function PreviewsRow({ slug, hasRequiredPreviews, xGitHub }: Props) {
9+
export function PreviewsRow({ slug, xGitHub }: Props) {
1110
const { t } = useTranslation('products')
1211
const hasPreviews = xGitHub.previews && xGitHub.previews.length > 0
1312

@@ -19,21 +18,17 @@ export function PreviewsRow({ slug, hasRequiredPreviews, xGitHub }: Props) {
1918
<td>string</td>
2019
<td>header</td>
2120
<td>
22-
{hasRequiredPreviews ? (
23-
<p>{t('rest.reference.preview_notice_to_change')}.</p>
24-
) : (
25-
<p className="m-0">
26-
Setting to
27-
<code>application/vnd.github.v3+json</code> is recommended.
28-
{hasPreviews && (
29-
<a href={`#${slug}-preview-notices`} className="d-inline">
30-
{xGitHub.previews.length > 1
31-
? ` ${t('rest.reference.see_preview_notices')}`
32-
: ` ${t('rest.reference.see_preview_notice')}`}
33-
</a>
34-
)}
35-
</p>
36-
)}
21+
<p className="m-0">
22+
Setting to
23+
<code>application/vnd.github.v3+json</code> is recommended.
24+
{hasPreviews && (
25+
<a href={`#${slug}-preview-notices`} className="d-inline">
26+
{xGitHub.previews.length > 1
27+
? ` ${t('rest.reference.see_preview_notices')}`
28+
: ` ${t('rest.reference.see_preview_notice')}`}
29+
</a>
30+
)}
31+
</p>
3732
</td>
3833
</tr>
3934
)

components/rest/RestOperation.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ import { RestResponse } from './RestResponse'
66
import { Operation } from './types'
77
import { RestNotes } from './RestNotes'
88
import { RestPreviewNotice } from './RestPreviewNotice'
9+
import { useTranslation } from 'components/hooks/useTranslation'
10+
import { RestStatusCodes } from './RestStatusCodes'
911

1012
type Props = {
1113
operation: Operation
1214
index: number
1315
}
1416

1517
export function RestOperation({ operation }: Props) {
18+
const { t } = useTranslation('products')
1619
const previews = operation['x-github'].previews
17-
const hasRequiredPreviews = previews
18-
? previews.filter((preview) => preview.required).length > 0
19-
: false
20+
const nonErrorResponses = operation.responses.filter(
21+
(response) => parseInt(response.httpStatusCode) < 400
22+
)
2023

2124
return (
2225
<div>
@@ -29,7 +32,6 @@ export function RestOperation({ operation }: Props) {
2932
{operation.parameters && (
3033
<RestParameterTable
3134
slug={operation.slug}
32-
hasRequiredPreviews={hasRequiredPreviews}
3335
xGitHub={operation['x-github']}
3436
parameters={operation.parameters}
3537
bodyParameters={operation.bodyParameters}
@@ -38,7 +40,7 @@ export function RestOperation({ operation }: Props) {
3840
{operation['x-codeSamples'] && operation['x-codeSamples'].length > 0 && (
3941
<RestCodeSamples slug={operation.slug} xCodeSamples={operation['x-codeSamples']} />
4042
)}
41-
<RestResponse responses={operation.responses} />
43+
<RestResponse responses={nonErrorResponses} />
4244
{(operation.notes.length > 0 || operation['x-github'].enabledForGitHubApps) && (
4345
<RestNotes
4446
notes={operation.notes}
@@ -48,7 +50,7 @@ export function RestOperation({ operation }: Props) {
4850
{previews && (
4951
<RestPreviewNotice slug={operation.slug} previews={operation['x-github'].previews} />
5052
)}
51-
<RestResponse responses={operation.responses} variant="error" />
53+
<RestStatusCodes heading={t('rest.reference.status_codes')} responses={operation.responses} />
5254
</div>
5355
)
5456
}

components/rest/RestParameterTable.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,12 @@ import { BodyParameterRows } from './BodyParametersRows'
88

99
type Props = {
1010
slug: string
11-
hasRequiredPreviews: boolean
1211
xGitHub: xGitHub
1312
parameters: Array<Parameter>
1413
bodyParameters: Array<BodyParameter>
1514
}
1615

17-
export function RestParameterTable({
18-
slug,
19-
hasRequiredPreviews,
20-
xGitHub,
21-
parameters,
22-
bodyParameters,
23-
}: Props) {
16+
export function RestParameterTable({ slug, xGitHub, parameters, bodyParameters }: Props) {
2417
const { t } = useTranslation('products')
2518

2619
return (
@@ -38,7 +31,7 @@ export function RestParameterTable({
3831
</tr>
3932
</thead>
4033
<tbody>
41-
<PreviewsRow slug={slug} hasRequiredPreviews={hasRequiredPreviews} xGitHub={xGitHub} />
34+
<PreviewsRow slug={slug} xGitHub={xGitHub} />
4235
<ParameterRows parameters={parameters} />
4336
<BodyParameterRows slug={slug} bodyParameters={bodyParameters} />
4437
</tbody>

components/rest/RestResponse.tsx

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,20 @@
11
import { CodeResponse } from './types'
22
import { CodeBlock } from './CodeBlock'
3-
import { useTranslation } from 'components/hooks/useTranslation'
4-
import { RestResponseTable } from './RestResponseTable'
53

64
type Props = {
75
responses: Array<CodeResponse>
8-
variant?: 'non-error' | 'error'
96
}
107

118
export function RestResponse(props: Props) {
12-
const { responses, variant = 'non-error' } = props
13-
const { t } = useTranslation('products')
9+
const { responses } = props
1410

1511
if (!responses || responses.length === 0) {
1612
return null
1713
}
1814

19-
const filteredResponses = responses.filter((response) => {
20-
const responseCode = parseInt(response.httpStatusCode)
21-
22-
if (variant === 'error') {
23-
return responseCode >= 400
24-
} else {
25-
return responseCode < 400
26-
}
27-
})
28-
29-
if (filteredResponses.length === 0) {
30-
return null
31-
}
32-
33-
if (variant === 'error') {
34-
return (
35-
<RestResponseTable heading={t('rest.reference.error_codes')} responses={filteredResponses} />
36-
)
37-
}
38-
3915
return (
4016
<>
41-
{filteredResponses.map((response, index) => {
17+
{responses.map((response, index) => {
4218
return (
4319
<div key={`${response.httpStatusMessage}-${index}}`}>
4420
<h4 dangerouslySetInnerHTML={{ __html: response.description }} />

0 commit comments

Comments
 (0)