Skip to content

Commit 7b98cf0

Browse files
authored
Merge branch 'main' into patch-1
2 parents eba4123 + b1a68cb commit 7b98cf0

File tree

1,632 files changed

+198338
-89472
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,632 files changed

+198338
-89472
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# To find available Node images, see https://mcr.microsoft.com/en-us/product/devcontainers/javascript-node/tags
22

33
# [Choice] Node.js version
4-
ARG VARIANT="dev-20-bullseye"
4+
ARG VARIANT="dev-22-bullseye"
55
FROM mcr.microsoft.com/devcontainers/javascript-node:${VARIANT}
66

77
# [Optional] Uncomment this section to install additional OS packages.

.devcontainer/devcontainer.json

Lines changed: 55 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,67 @@
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/javascript-node
33
// -
44
{
5-
"name": "docs.github.com",
6-
"build": {
7-
"dockerfile": "Dockerfile",
8-
// Update 'VARIANT' to pick a Node version
9-
"args": { "VARIANT": "20" }
10-
},
5+
"name": "docs.github.com",
6+
"build": {
7+
"dockerfile": "Dockerfile",
8+
// Update 'VARIANT' to pick a Node version
9+
"args": { "VARIANT": "22" }
10+
},
1111

12-
// Install features. Type 'feature' in the VS Code command palette for a full list.
13-
"features": {
14-
"sshd": "latest"
15-
},
12+
// Install features. Type 'feature' in the VS Code command palette for a full list.
13+
"features": {
14+
"sshd": "latest"
15+
},
1616

17-
"customizations": {
18-
"vscode": {
19-
// Set *default* container specific settings.json values on container create.
20-
"settings": {
21-
"terminal.integrated.shell.linux": "/bin/bash",
22-
"cSpell.language": ",en"
23-
},
24-
// Visual Studio Code extensions which help authoring for docs.github.com.
25-
"extensions": [
26-
"dbaeumer.vscode-eslint",
27-
"sissel.shopify-liquid",
28-
"davidanson.vscode-markdownlint",
29-
"bierner.markdown-preview-github-styles",
30-
"streetsidesoftware.code-spell-checker",
31-
"alistairchristie.open-reusables",
32-
"AlistairChristie.version-identifier",
33-
"peterbe.ghdocs-goer",
34-
"GitHub.copilot",
35-
"GitHub.copilot-chat"
36-
]
37-
},
38-
"codespaces": {
39-
"repositories": {
40-
// allow Codespaces to pull from separate repo when user has access
41-
"github/docs-early-access": {
42-
"permissions": {
43-
"contents": "write"
44-
}
45-
}
46-
}
47-
}
17+
"customizations": {
18+
"vscode": {
19+
// Set *default* container specific settings.json values on container create.
20+
"settings": {
21+
"terminal.integrated.shell.linux": "/bin/bash",
22+
"cSpell.language": ",en"
23+
},
24+
// Visual Studio Code extensions which help authoring for docs.github.com.
25+
"extensions": [
26+
"dbaeumer.vscode-eslint",
27+
"sissel.shopify-liquid",
28+
"davidanson.vscode-markdownlint",
29+
"bierner.markdown-preview-github-styles",
30+
"streetsidesoftware.code-spell-checker",
31+
"alistairchristie.open-reusables",
32+
"AlistairChristie.version-identifier",
33+
"peterbe.ghdocs-goer",
34+
"GitHub.copilot",
35+
"GitHub.copilot-chat"
36+
]
4837
},
49-
50-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
51-
"forwardPorts": [4000],
52-
53-
"portsAttributes": {
54-
"4000": {
55-
"label": "Preview"
38+
"codespaces": {
39+
"repositories": {
40+
// allow Codespaces to pull from separate repo when user has access
41+
"github/docs-early-access": {
42+
"permissions": {
43+
"contents": "write"
44+
}
5645
}
57-
},
46+
}
47+
}
48+
},
5849

59-
// Use 'postCreateCommand' to run commands after the container is created.
60-
"postCreateCommand": "npm ci",
50+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
51+
"forwardPorts": [4000],
6152

62-
// Use 'updateContentCommand' to run commands to be included in Codespace pre-builds
63-
"updateContentCommand": "git clone https://github.com/github/rest-api-description.git",
53+
"portsAttributes": {
54+
"4000": {
55+
"label": "Preview"
56+
}
57+
},
6458

65-
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
66-
"remoteUser": "node",
59+
// Use 'postCreateCommand' to run commands after the container is created.
60+
"postCreateCommand": "npm ci",
6761

68-
"hostRequirements": {
69-
"memory": "8gb"
70-
}
62+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
63+
"remoteUser": "node",
64+
65+
"hostRequirements": {
66+
"memory": "8gb"
67+
}
7168
}

.env.example

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This file is a template for what your untracked .env file might look like for local development.
2+
# Please copy this to a new .env file and fill in the values as needed.
3+
4+
# Requires a running local Elasticsearch service. Can be started via Docker, see https://github.com/github/docs-engineering/blob/main/docs/elasticsearch/elasticsearch-locally.md
5+
# When this value is unset searches will be proxied to the production Elasticsearch endpoint
6+
ELASTICSEARCH_URL=http://localhost:9200
7+
8+
# Set for sending events in local development. See https://github.com/github/docs-engineering/blob/main/docs/analytics/hydro-mock.md
9+
HYDRO_ENDPOINT=
10+
HYDRO_SECRET=
11+
12+
# Localization variables
13+
# See https://github.com/github/docs-internal/tree/main/src/languages#working-with-translated-content-locally
14+
ENABLED_LANGUAGES=
15+
TRANSLATIONS_ROOT=
16+
17+
# For running the src/search/scripts/scrape script
18+
# You may want a lower value depending on your CPU
19+
BUILD_RECORDS_MAX_CONCURRENT=100
20+
BUILD_RECORDS_MIN_TIME=
21+
22+
# Set to true to enable the /fastly-cache-test route for debugging Fastly headers
23+
ENABLE_FASTLY_TESTING=

.github/branch_protection_settings/main.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"workflows",
4242
"lint-code",
4343
"secret-scanning",
44+
"pagelist"
4445
],
4546
"contexts_url": "https://api.github.com/repos/github/docs-internal/branches/main/protection/required_status_checks/contexts",
4647
"checks": [
@@ -83,7 +84,8 @@
8384
{ "context": "products", "app_id": 15368 },
8485
{ "context": "workflows", "app_id": 15368 },
8586
{ "context": "lint-code", "app_id": 15368 },
86-
{ "context": "secret-scanning", "app_id": 15368 }
87+
{ "context": "secret-scanning", "app_id": 15368 },
88+
{ "context": "pagelist", "app_id": 15368 }
8789
]
8890
},
8991
"restrictions": {

.github/workflows/alert-changed-branch-protections.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Alert Changed Branch Protections
33
on:
44
branch_protection_rule:
55
workflow_dispatch:
6+
schedule:
7+
- cron: '20 16 * * 3' # Run every Wednesday at 16:30 UTC / 8:30 PST
68

79
permissions:
810
contents: read

.github/workflows/azure-preview-env-deploy-public.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ jobs:
3737
build-and-deploy-azure-preview-public:
3838
name: Build and deploy Azure preview environment (public)
3939
runs-on: ubuntu-latest
40-
if: github.repository == 'github/docs'
40+
# Ensure this is actually a pull request and not a merge group
41+
# If its a merge group, report success without doing anything
42+
# See https://bit.ly/3qB9nZW > If a job in a workflow is skipped due to a conditional, it will report its status as "Success".
43+
if: |
44+
(
45+
(github.event.pull_request.head.sha)
46+
&& (github.event.number || github.run_id)
47+
)
48+
&& github.repository == 'github/docs'
4149
timeout-minutes: 15
4250
environment:
4351
name: preview-env-${{ github.event.number }}

.github/workflows/azure-prod-build-deploy.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,14 @@ jobs:
3434
RESOURCE_GROUP_NAME: docs-prod
3535
APP_SERVICE_NAME: ghdocs-prod
3636
SLOT_NAME: canary
37+
ACR_TOKEN_NAME: acrToken
3738

3839
steps:
3940
- name: 'Az CLI login'
4041
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # pin @v2
4142
with:
4243
creds: ${{ secrets.PROD_AZURE_CREDENTIALS }}
4344

44-
- name: 'Docker login'
45-
uses: azure/docker-login@15c4aadf093404726ab2ff205b2cdd33fa6d054c
46-
with:
47-
login-server: ${{ secrets.PROD_REGISTRY_SERVER }}
48-
username: ${{ secrets.PROD_REGISTRY_USERNAME }}
49-
password: ${{ secrets.PROD_REGISTRY_PASSWORD }}
50-
51-
- name: Set up Docker Buildx
52-
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db
53-
5445
- name: Check out repo
5546
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
5647
with:
@@ -64,11 +55,29 @@ jobs:
6455
node-version-file: 'package.json'
6556
cache: npm
6657

67-
# Currently we only need this to run dependencies in
68-
# src/workflows/check-canary-slots.js
58+
# We need this to run a few scripts that were easier to write in JS/TS
6959
- name: Install dependencies
7060
run: npm install
7161

62+
# Create a temporary token for the Azure Container Registry
63+
# and set it as a GitHub Actions environment variable
64+
# Created token are viewable in the ACR resource UI
65+
# under Repository permissions > Tokens
66+
- name: 'Create Azure Container Registry Token'
67+
env:
68+
CONTAINER_REGISTRY_SERVER: ${{ secrets.PROD_REGISTRY_SERVER }}
69+
run: npm run create-acr-token
70+
71+
- name: 'Docker login'
72+
uses: azure/docker-login@15c4aadf093404726ab2ff205b2cdd33fa6d054c
73+
with:
74+
login-server: ${{ secrets.PROD_REGISTRY_SERVER }}
75+
username: ${{ env.ACR_TOKEN_NAME }}
76+
password: ${{ env.ACR_TOKEN_VALUE }}
77+
78+
- name: Set up Docker Buildx
79+
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db
80+
7281
- name: Clone docs-early-access
7382
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
7483
with:

.github/workflows/index-autocomplete-elasticsearch.yml renamed to .github/workflows/index-autocomplete-search.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: Index autocomplete Elasticsearch
1+
name: Index autocomplete search in Elasticsearch
22

3-
# **What it does**: Indexes autocomplete data into Elasticsearch.
4-
# **Why we have it**: So we can power the API for autocomplete.
3+
# **What it does**: Indexes autocomplete data (general and AI search) into Elasticsearch.
4+
# **Why we have it**: So we can power the APIs for autocomplete.
55
# **Who does it impact**: docs-engineering
66

77
on:
@@ -10,7 +10,7 @@ on:
1010
- cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST
1111
pull_request:
1212
paths:
13-
- .github/workflows/index-autocomplete-elasticsearch.yml
13+
- .github/workflows/index-autocomplete-search.yml
1414
- 'src/search/scripts/index/**'
1515
- 'package*.json'
1616

@@ -40,10 +40,15 @@ jobs:
4040
if: ${{ github.event_name == 'pull_request' }}
4141
run: curl --fail --retry-connrefused --retry 5 -I http://localhost:9200
4242

43-
- name: Run indexing
43+
- name: Run general auto-complete indexing
4444
env:
4545
ELASTICSEARCH_URL: ${{ github.event_name == 'pull_request' && 'http://localhost:9200' || secrets.ELASTICSEARCH_URL }}
46-
run: npm run index -- autocomplete docs-internal-data
46+
run: npm run index-general-autocomplete -- docs-internal-data
47+
48+
- name: Run AI search auto-complete indexing
49+
env:
50+
ELASTICSEARCH_URL: ${{ github.event_name == 'pull_request' && 'http://localhost:9200' || secrets.ELASTICSEARCH_URL }}
51+
run: npm run index-ai-search-autocomplete -- docs-internal-data
4752

4853
- uses: ./.github/actions/slack-alert
4954
if: ${{ failure() && github.event_name == 'schedule' }}

.github/workflows/sync-search-pr.yml renamed to .github/workflows/index-general-search-pr.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Sync search - PR
1+
name: Index general search in Elasticsearch on PR
22

3-
# **What it does**: This does what `sync-sarch-elasticsearch.yml` does but
3+
# **What it does**: This does what `index-general-search-elasticsearch.yml` does but
44
# with a localhost Elasticsearch and only for English.
55
# **Why we have it**: To test that the script works and the popular pages json is valid.
66
# **Who does it impact**: Docs engineering
@@ -11,8 +11,8 @@ on:
1111
paths:
1212
- 'src/search/**'
1313
- 'package*.json'
14-
# Ultimately, for debugging this workflow itself
15-
- .github/workflows/sync-search-pr.yml
14+
# For debugging this workflow
15+
- .github/workflows/index-general-search-pr.yml
1616
# Make sure we run this if the composite action changes
1717
- .github/actions/setup-elasticsearch/action.yml
1818

@@ -25,9 +25,6 @@ concurrency:
2525
cancel-in-progress: true
2626

2727
env:
28-
# Yes, it's hardcoded but it makes all the steps look exactly the same
29-
# as they do in `sync-search-elasticsearch.yml` where it uses
30-
# that `${{ env.ELASTICSEARCH_URL }}`
3128
ELASTICSEARCH_URL: http://localhost:9200
3229
# Since we'll run in NDOE_ENV=production, we need to be explicit that
3330
# we don't want Hydro configured.
@@ -63,7 +60,7 @@ jobs:
6360
env:
6461
ENABLE_DEV_LOGGING: false
6562
run: |
66-
npm run sync-search-server > /tmp/stdout.log 2> /tmp/stderr.log &
63+
npm run general-search-scrape-server > /tmp/stdout.log 2> /tmp/stderr.log &
6764
6865
# first sleep to give it a chance to start
6966
sleep 6
@@ -88,15 +85,13 @@ jobs:
8885
# let's just accept an empty string instead.
8986
THROW_ON_EMPTY: false
9087

91-
# The sync-search-index recognizes this env var if you don't
92-
# use the `--docs-internal-data <PATH>` option.
9388
DOCS_INTERNAL_DATA: docs-internal-data
9489

9590
run: |
9691
mkdir /tmp/records
97-
npm run sync-search-indices -- /tmp/records \
92+
npm run general-search-scrape -- /tmp/records \
9893
--language en \
99-
--version dotcom
94+
--version fpt
10095
10196
ls -lh /tmp/records
10297
@@ -106,9 +101,9 @@ jobs:
106101
107102
- name: Index into Elasticsearch
108103
run: |
109-
npm run index-elasticsearch -- /tmp/records \
104+
npm run index-general-search -- /tmp/records \
110105
--language en \
111-
--version dotcom
106+
--version fpt
112107
113108
- name: Check created indexes and aliases
114109
run: |

0 commit comments

Comments
 (0)