Skip to content

Commit 5442cbb

Browse files
authored
Merge branch 'main' into Mini256-patch
2 parents 8da864b + 1bd90a4 commit 5442cbb

5,622 files changed

Lines changed: 166966 additions & 165710 deletions

File tree

Some content is hidden

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

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@
3333

3434
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
3535
"remoteUser": "node"
36+
3637
}

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
babelOptions: { configFile: './.babelrc' },
1414
sourceType: 'module',
1515
},
16-
ignorePatterns: ['tmp/*'],
16+
ignorePatterns: ['tmp/*', '!/.*', '/.next/'],
1717
rules: {
1818
'import/no-extraneous-dependencies': ['error', { packageDir: '.' }],
1919
},

.github/CODEOWNERS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@
1010
/.github/ @github/docs-engineering
1111
/script/ @github/docs-engineering
1212
/includes/ @github/docs-engineering
13+
/lib/search/popular-pages.json @github/docs-engineering
1314
app.json @github/docs-engineering
1415
Dockerfile @github/docs-engineering
1516
package-lock.json @github/docs-engineering
1617
package.json @github/docs-engineering
1718

1819
# Localization
20+
/.github/workflows/create-translation-batch-pr.yml @github/docs-localization
1921
/.github/workflows/crowdin.yml @github/docs-localization
2022
/crowdin*.yml @github/docs-engineering @github/docs-localization
21-
/translations/ @github/docs-engineering @github/docs-localization @github-actions
23+
/translations/ @github/docs-engineering @github/docs-localization @Octomerger
24+
/translations/log/ @github/docs-localization @Octomerger
2225

2326
# Site Policy
2427
/content/github/site-policy/ @github/site-policy-admins
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env node
2+
3+
import path from 'path'
4+
import fs from 'fs'
5+
import zlib from 'zlib'
6+
import walk from 'walk-sync'
7+
8+
const DRY_RUN = Boolean(JSON.parse(process.env.DRY_RUN || 'false'))
9+
// Roughly 100KiB means about 25 files at the moment.
10+
// Set this too low and the overheads will be more than the disk and
11+
// network I/O that this intends to serve.
12+
const MIN_GZIP_SIZE = Number(process.env.MIN_GZIP_SIZE || 1024 * 100)
13+
14+
const BROTLI_OPTIONS = {
15+
params: {
16+
[zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT,
17+
[zlib.constants.BROTLI_PARAM_QUALITY]: 6,
18+
},
19+
}
20+
main()
21+
22+
async function main() {
23+
compressFromPattern('lib/**/static/**/*.json')
24+
}
25+
26+
async function compressFromPattern(pattern) {
27+
const glob = pattern.includes('*') ? pattern.split(path.sep).slice(1).join(path.sep) : undefined
28+
const walkOptions = {
29+
globs: glob ? [glob] : undefined,
30+
directories: false,
31+
includeBasePath: true,
32+
}
33+
const root = path.resolve(pattern.includes('*') ? pattern.split(path.sep)[0] : pattern)
34+
const filePaths = walk(root, walkOptions).filter((filePath) => {
35+
return fs.statSync(filePath).size > MIN_GZIP_SIZE
36+
})
37+
38+
if (!DRY_RUN) {
39+
console.time(`Compress ${filePaths.length} files`)
40+
const compressed = await Promise.all(filePaths.map(compressFile))
41+
console.timeEnd(`Compress ${filePaths.length} files`)
42+
43+
console.time(`Delete ${compressed.length} files`)
44+
compressed.forEach((filePath) => fs.unlinkSync(filePath))
45+
console.timeEnd(`Delete ${compressed.length} files`)
46+
}
47+
}
48+
49+
function compressFile(filePath) {
50+
return new Promise((resolve, reject) => {
51+
const contentStream = fs.createReadStream(filePath)
52+
const newFilePath = `${filePath}.br`
53+
const writeStream = fs.createWriteStream(newFilePath)
54+
const compressor = zlib.createBrotliCompress(BROTLI_OPTIONS)
55+
contentStream
56+
.pipe(compressor)
57+
.pipe(writeStream)
58+
.on('finish', (err) => {
59+
if (err) return reject(err)
60+
resolve(filePath)
61+
})
62+
})
63+
}

.github/actions-scripts/enterprise-server-issue-templates/release-issue.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ If you aren't comfortable going through the steps alone, sync up with a docs eng
1212
- [ ] Increment the `next` variable above the `supported` array (e.g., new release number + `.1`).
1313
- [ ] Increment the `nextNext` variable above the `supported` array (e.g., new release number + `.2`).
1414
- [ ] Update the GHES dates file:
15-
- [ ] Make sure you have a `.env` file at the root directory of your local checkout, and that it contains a PAT in the format of `GITHUB_TOKEN=<token>`.
15+
- [ ] Make sure you have a `.env` file at the root directory of your local checkout, and that it contains a PAT in the format of `GITHUB_TOKEN=<token>` with `repo` scope. Ensure the PAT is SSO-enabled for the `github` org.
1616
- [ ] Run the script to update the dates file:
1717

1818
```
1919
script/update-enterprise-dates.js
2020
```
21-
- [ ] Create REST files based on previous version:
21+
- [ ] Create REST files based on previous version. For example `script/enterprise-server-releases/create-rest-files.js --oldVersion enterprise-server@3.2 --newVersion enterprise-server@3.3`:
2222
2323
```
2424
script/enterprise-server-releases/create-rest-files.js --oldVersion <PLAN@RELEASE> --newVersion <PLAN@RELEASE>
@@ -33,7 +33,7 @@ If you aren't comfortable going through the steps alone, sync up with a docs eng
3333
```
3434
script/enterprise-server-releases/create-webhook-files.js --oldVersion <PLAN@RELEASE> --newVersion <PLAN@RELEASE>
3535
```
36-
- [ ] Create a placeholder release notes file called `data/release-notes/<PRODUCT>/<RELEASE NUMBER>/PLACEHOLDER.yml`. For example `data/release-notes/3-1/PLACEHOLDER.yml`. Add the following placeholder content to the file:
36+
- [ ] Create a placeholder release notes file called `data/release-notes/<PRODUCT>/<RELEASE NUMBER>/PLACEHOLDER.yml`. For example `data/release-notes/enterprise-server/3-1/PLACEHOLDER.yml`. Add the following placeholder content to the file:
3737
3838
```
3939
date: '2021-05-04'
@@ -55,6 +55,8 @@ If you aren't comfortable going through the steps alone, sync up with a docs eng
5555
script/enterprise-server-releases/release-banner.js --action create --version <PLAN@RELEASE>
5656
```
5757
58+
- [ ] Create a PR with the above changes. This PR is used to track all docs changes and smoke tests associated with the release. For example https://github.com/github/docs-internal/pull/22286.
59+
5860
### When the `docs-internal` release branch is open
5961
6062
- [ ] Add a label to the PR in this format:
@@ -102,7 +104,7 @@ This file should be automatically updated, but you can also run `script/update-e
102104
Usually, we should smoke test any new GHES admin guides, any large features landing in this GHES version for the first time, and the REST and GraphQL API references.
103105
- [ ] Alert the Neon Squad (formally docs-ecosystem team) 1-2 days before the release to deploy to `github/github`. A PR should already be open in `github/github`, to change `published` to `true` in `app/api/description/config/releases/ghes-<NEXT RELEASE NUMBER>.yaml`. They will need to:
104106
- [ ] Get the required approval from `@github/ecosystem-api-reviewers` then deploy the PR to dotcom. This process generally takes 30-90 minutes.
105-
- [ ] Once the PR merges, make sure that the auto-generated PR titled "Update OpenAPI Descriptions" in doc-internal contains both the derefrenced and decorated JSON files for the new GHES release. If everything looks good, merge the "Update OpenAPI Description" PR into the GHES release megabranch.
107+
- [ ] Once the PR merges, make sure that the auto-generated PR titled "Update OpenAPI Descriptions" in doc-internal contains both the derefrenced and decorated JSON files for the new GHES release. If everything looks good, merge the "Update OpenAPI Description" PR into the GHES release megabranch. **Note:** Be careful about resolving the conflicts correctly—you may wish to delete the existing OpenAPI files for the release version from the megabranch, so there are no conflicts to resolve and to ensure that the incoming artifacts are the correct ones.
106108
- [ ] Add a blocking review to the auto-generated "Update OpenAPI Descriptions" PR in the public REST API description. (Remove this blocking review once the GHES release ships.)
107109
- [ ] [Freeze the repos](https://github.com/github/docs-content/blob/main/docs-content-docs/docs-content-workflows/freezing.md) at least 1-2 days before the release, and post an announcement in Slack so everybody knows.
108110
@@ -113,8 +115,9 @@ This file should be automatically updated, but you can also run `script/update-e
113115
114116
Use admin permissions to ship the release branch with this failure. Make sure that the merge's commit title does not include anything like `[DO NOT MERGE]`, and remove all the branch's commit details from the merge's commit message except for the co-author list.
115117
- [ ] Do any required smoke tests listed in the opening post in the megabranch PR.
116-
- [ ] Push the search index LFS objects for the public `github/docs` repo. The LFS objects were already being pushed for the internal repo after the `sync-english-index-for-<PLAN@RELEASE>` was added to the megabranch. To push the LFS objects, run the [search sync workflow](https://github.com/github/docs-internal/actions/workflows/sync-search-indices.yml) with the following inputs:
118+
- [ ] Once smoke tests have passed, you can [unfreeze the repos](https://github.com/github/docs-content/blob/main/docs-content-docs/docs-content-workflows/freezing.md) and post an announcement in Slack.
119+
- [ ] After unfreezing, push the search index LFS objects for the public `github/docs` repo. The LFS objects were already being pushed for the internal repo after the `sync-english-index-for-<PLAN@RELEASE>` was added to the megabranch. To push the LFS objects, run the [search sync workflow](https://github.com/github/docs-internal/actions/workflows/sync-search-indices.yml) with the following inputs:
117120
version: `enterprise-server@<RELEASE>`
118121
language: `en`
119-
- [ ] Once smoke tests have passed, you can [unfreeze the repos](https://github.com/github/docs-content/blob/main/docs-content-docs/docs-content-workflows/freezing.md) and post an announcement in Slack.
120-
- [ ] After the release, in the `docs-content` repo, add the now live version number to the "Specific GHES version(s)" section in the following files: [`.github/ISSUE_TEMPLATE/release-tier-1-or-2-tracking.yml`](https://github.com/github/docs-content/blob/main/.github/ISSUE_TEMPLATE/release-tier-1-or-2-tracking.yml) and [`.github/ISSUE_TEMPLATE/release-tier-3-or-tier-4.yml`](https://github.com/github/docs-content/blob/main/.github/ISSUE_TEMPLATE/release-tier-3-or-tier-4.yml). When the PR is approved, merge it in.
122+
- [ ] After unfreezing, if there were significant or highlighted GraphQL changes in the release, consider manually running the [GraphQL update workflow](https://github.com/github/docs-internal/actions/workflows/update-graphql-files.yml) to update our GraphQL schemas. By default this workflow only runs once every 24 hours.
123+
- [ ] After the release, in the `docs-content` repo, add the now live version number to the "Specific GHES version(s)" section in the following files: [`.github/ISSUE_TEMPLATE/release-tier-1-or-2-tracking.yml`](https://github.com/github/docs-content/blob/main/.github/ISSUE_TEMPLATE/release-tier-1-or-2-tracking.yml) and [`.github/ISSUE_TEMPLATE/release-tier-3-or-tier-4.yml`](https://github.com/github/docs-content/blob/main/.github/ISSUE_TEMPLATE/release-tier-3-or-tier-4.yml). When the PR is approved, merge it in.

.github/actions-scripts/fr-add-docs-reviewers-requests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ async function run() {
134134
// Exclude existing items going forward.
135135
// Until we have a way to check from a PR whether the PR is in a project,
136136
// this is how we (roughly) avoid overwriting PRs that are already on the board
137-
let newItemIDs = []
138-
let newItemAuthors = []
137+
const newItemIDs = []
138+
const newItemAuthors = []
139139
itemIDs.forEach((id, index) => {
140140
if (!existingItemIDs.includes(id)) {
141141
newItemIDs.push(id)

.github/actions-scripts/purge-fastly-edge-cache.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,4 @@
22

33
import purgeEdgeCache from '../../script/deployment/purge-edge-cache.js'
44

5-
try {
6-
await purgeEdgeCache()
7-
} catch (error) {
8-
console.error(`Failed to purge the edge cache: ${error.message}`)
9-
console.error(error)
10-
throw error
11-
}
5+
await purgeEdgeCache()

.github/actions-scripts/ready-for-docs-review.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ async function run() {
8585
// - affected docs sets (not considering changes to data/assets)
8686
let numFiles = 0
8787
let numChanges = 0
88-
let features = new Set([])
89-
const files = data.item.files.nodes.forEach((node) => {
88+
const features = new Set([])
89+
data.item.files.nodes.forEach((node) => {
9090
numFiles += 1
9191
numChanges += node.additions
9292
numChanges += node.deletions
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env node
2+
3+
import * as github from '@actions/github'
4+
5+
import getOctokit from '../../script/helpers/github.js'
6+
7+
const { GITHUB_TOKEN } = process.env
8+
9+
// Exit if GitHub Actions PAT is not found
10+
if (!GITHUB_TOKEN) {
11+
throw new Error('You must supply a GITHUB_TOKEN environment variable!')
12+
}
13+
14+
// This helper uses the `GITHUB_TOKEN` implicitly!
15+
// We're using our usual version of Octokit vs. the provided `github`
16+
// instance to avoid versioning discrepancies.
17+
const octokit = getOctokit()
18+
19+
const { CONTEXT_NAME, ACTIONS_RUN_LOG, HEAD_SHA } = process.env
20+
if (!CONTEXT_NAME) {
21+
throw new Error('$CONTEXT_NAME not set')
22+
}
23+
if (!ACTIONS_RUN_LOG) {
24+
throw new Error('$ACTIONS_RUN_LOG not set')
25+
}
26+
if (!HEAD_SHA) {
27+
throw new Error('$HEAD_SHA not set')
28+
}
29+
30+
const { context } = github
31+
const owner = context.repo.owner
32+
const repo = context.payload.repository.name
33+
34+
await octokit.repos.createCommitStatus({
35+
owner,
36+
repo,
37+
sha: HEAD_SHA,
38+
context: CONTEXT_NAME,
39+
state: 'success',
40+
description: 'Successfully deployed! See logs.',
41+
target_url: ACTIONS_RUN_LOG,
42+
})

.github/actions-scripts/staging-deploy.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if (!HEROKU_API_TOKEN) {
2121
// instance to avoid versioning discrepancies.
2222
const octokit = getOctokit()
2323

24-
const { RUN_ID, PR_URL, SOURCE_BLOB_URL, CONTEXT_NAME, ACTIONS_RUN_LOG, HEAD_SHA } = process.env
24+
const { RUN_ID, PR_URL, SOURCE_BLOB_URL } = process.env
2525
if (!RUN_ID) {
2626
throw new Error('$RUN_ID not set')
2727
}
@@ -31,15 +31,6 @@ if (!PR_URL) {
3131
if (!SOURCE_BLOB_URL) {
3232
throw new Error('$SOURCE_BLOB_URL not set')
3333
}
34-
if (!CONTEXT_NAME) {
35-
throw new Error('$CONTEXT_NAME not set')
36-
}
37-
if (!ACTIONS_RUN_LOG) {
38-
throw new Error('$ACTIONS_RUN_LOG not set')
39-
}
40-
if (!HEAD_SHA) {
41-
throw new Error('$HEAD_SHA not set')
42-
}
4334

4435
const { owner, repo, pullNumber } = parsePrUrl(PR_URL)
4536
if (!owner || !repo || !pullNumber) {
@@ -62,13 +53,3 @@ await deployToStaging({
6253
sourceBlobUrl: SOURCE_BLOB_URL,
6354
runId: RUN_ID,
6455
})
65-
66-
await octokit.repos.createCommitStatus({
67-
owner,
68-
repo,
69-
sha: HEAD_SHA,
70-
context: CONTEXT_NAME,
71-
state: 'success',
72-
description: 'Successfully deployed! See logs.',
73-
target_url: ACTIONS_RUN_LOG,
74-
})

0 commit comments

Comments
 (0)