Skip to content

Commit 165fb1b

Browse files
authored
Merge branch 'main' into patch-2
2 parents 3b486e2 + b4f687b commit 165fb1b

File tree

1,271 files changed

+20495
-18627
lines changed

Some content is hidden

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

1,271 files changed

+20495
-18627
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/orphaned-assets-check.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@ name: 'Orphaned assets check'
55
# **Who does it impact**: Docs content.
66

77
on:
8-
pull_request:
9-
push:
10-
branches:
11-
- gh-readonly-queue/main/**
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '13 10 * * *' # Once a day at 10:13 UTC
1211

1312
permissions:
1413
contents: read
1514

1615
jobs:
1716
orphaned-assets-check:
17+
if: ${{ github.repository == 'github/docs-internal' }}
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
22+
with:
23+
# Using a PAT is necessary so that the new commit will trigger the
24+
# CI in the PR. (Events from GITHUB_TOKEN don't trigger new workflows.)
25+
token: ${{ secrets.DOCUBOT_REPO_PAT }}
2226

2327
- name: Setup node
2428
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561
@@ -30,4 +34,30 @@ jobs:
3034
run: npm ci
3135

3236
- name: Check for orphaned assets
33-
run: ./script/find-orphaned-assets.mjs --verbose --exit
37+
env:
38+
# Needed for gh
39+
GITHUB_TOKEN: ${{ secrets.DOCUBOT_REPO_PAT }}
40+
run: |
41+
set -e
42+
43+
./script/find-orphaned-assets.mjs | xargs git rm
44+
45+
# If nothing to commit, exit now. It's fine. No orphans.
46+
git status | grep 'nothing to commit' && exit 0
47+
48+
# Replicated from the translation pipeline PR-maker Action
49+
git config --global user.name "docubot"
50+
git config --global user.email "[email protected]"
51+
52+
date=$(date '+%Y-%m-%d-%H-%M')
53+
branchname=orphaned-assets-$date-$GITHUB_RUN_ID
54+
55+
git checkout -b $branchname
56+
git commit -m "Delete orphaned assets $date"
57+
git push origin $branchname
58+
59+
gh pr create \
60+
--title "Delete orphaned assets ($date)" \
61+
--body "Found with the find-orphaned-assets.mjs script" \
62+
--repo github/docs-internal \
63+
--label docs-content-fr

.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 }}/

CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Binary file not shown.
Binary file not shown.
28 KB
-6.76 KB
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.
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/context/ProductLandingContext.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ export type ProductLandingContextT = {
3838
intro: string
3939
beta_product: boolean
4040
product: Product
41-
introLinks: {
42-
quickstart?: string
43-
reference?: string
44-
overview?: string
45-
} | null
41+
introLinks: Record<string, string> | null
4642
product_video?: string
4743
featuredLinks: Record<string, Array<FeaturedLink>>
4844
productCodeExamples: Array<CodeExample>
@@ -128,13 +124,7 @@ export const getProductLandingContextFromRequest = (req: any): ProductLandingCon
128124
})
129125
),
130126

131-
introLinks: page.introLinks
132-
? {
133-
quickstart: page.introLinks.quickstart,
134-
reference: page.introLinks.reference,
135-
overview: page.introLinks.overview,
136-
}
137-
: null,
127+
introLinks: page.introLinks || null,
138128

139129
featuredLinks: getFeaturedLinksFromReq(req),
140130

components/landing/LandingHero.tsx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { useEffect, useState } from 'react'
22
import cx from 'classnames'
33
import { useRouter } from 'next/router'
4-
import { useMainContext } from 'components/context/MainContext'
4+
import { LinkExternalIcon } from '@primer/octicons-react'
55

6+
import { useMainContext } from 'components/context/MainContext'
67
import { Link } from 'components/Link'
78
import { useProductLandingContext } from 'components/context/ProductLandingContext'
89
import { useTranslation } from 'components/hooks/useTranslation'
@@ -46,7 +47,7 @@ export const LandingHero = () => {
4647
href={link}
4748
className={cx('btn btn-large f4 mt-3 mr-3 ', i === 0 && 'btn-primary')}
4849
>
49-
{t(key)}
50+
{t(key) || key}
5051
</FullLink>
5152
)
5253
})}
@@ -72,7 +73,8 @@ export const LandingHero = () => {
7273
)
7374
}
7475

75-
// Fully Qualified Link - it includes the version and locale in the path
76+
// Fully Qualified Link - it includes the version and locale in the path if
77+
// the href is not an external link.
7678
type Props = {
7779
href: string
7880
children: React.ReactNode
@@ -81,13 +83,24 @@ type Props = {
8183
export const FullLink = ({ href, children, className }: Props) => {
8284
const router = useRouter()
8385
const { currentVersion } = useVersion()
84-
const locale = router.locale || 'en'
85-
const fullyQualifiedHref = `/${locale}${
86-
currentVersion !== 'free-pro-team@latest' ? `/${currentVersion}` : ''
87-
}${href}`
86+
87+
const isExternal = href.startsWith('https')
88+
let linkHref = href
89+
if (!isExternal) {
90+
const locale = router.locale || 'en'
91+
linkHref = `/${locale}${
92+
currentVersion !== 'free-pro-team@latest' ? `/${currentVersion}` : ''
93+
}${href}`
94+
}
95+
8896
return (
89-
<Link href={fullyQualifiedHref} className={className}>
90-
{children}
97+
<Link href={linkHref} className={className}>
98+
{children}{' '}
99+
{isExternal && (
100+
<span className="ml-1">
101+
<LinkExternalIcon size="small" />
102+
</span>
103+
)}
91104
</Link>
92105
)
93106
}

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() {

0 commit comments

Comments
 (0)