Skip to content

Commit ee7b87a

Browse files
authored
Merge branch 'main' into patch-1
2 parents a64523e + 661fff9 commit ee7b87a

File tree

856 files changed

+3153365
-747142
lines changed

Some content is hidden

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

856 files changed

+3153365
-747142
lines changed

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

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ The day after a GHES version's [deprecation date](https://github.com/github/docs
66

77
The following large repositories are used throughout this checklist, it may be useful to clone them before you begin:
88

9-
- `github/help-docs-archived-enterprise-versions`
109
- `github/github`
1110
- `github/docs-internal`
1211

@@ -18,46 +17,85 @@ Additionally, you may want to download:
1817

1918
**Note**: This step can be performed independently of all other steps, and can be done several days before or along with the other steps.
2019

21-
- [ ] In the `docs-content` repo, remove the deprecated GHES version number from the "Specific GHES version(s)" section in the following files (in the `.github/ISSUE_TEMPLATE/` directory): [`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 [`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).
20+
- [ ] In the `docs-content` repo, remove the deprecated GHES version number from the `options` list in the following files (in the `.github/ISSUE_TEMPLATE/` directory): [`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 [`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).
2221
- [ ] When the PR is approved, merge it in. This can be merged independently from all other steps.
2322

2423
## Step 1: Scrape the docs and archive the files
2524

26-
- [ ] In your checkout of the [repo with archived GHES content](https://github.com/github/help-docs-archived-enterprise-versions), create a new branch: `git checkout -b deprecate-<version>`
2725
- [ ] In your `docs-internal` checkout, download the static files for the oldest supported version into your archival checkout:
2826
The archive script depends on an optional dependency so install optional dependencies first:
2927
```
30-
$ npm i --include-optional
28+
$ npm i --include=optional
3129
```
3230
Ensure your build is up to date:
3331
```
3432
$ npm run build
3533
```
3634
Then run the archive script:
3735
```
38-
$ script/enterprise-server-deprecations/archive-version.js -p <path-to-archive-repo-checkout>
36+
$ script/enterprise-server-deprecations/archive-version.js
3937
```
40-
If your checkouts live in the same directory, this command would be:
38+
39+
This will generate a directory in `github/docs-internal` called `tmpArchivalDir_<VERSION_TO_DEPRECATE>`. For example 'tmpArchivalDir_3.0'. You can also create a specific output directory using the `--output` flag.
40+
41+
**Note:** You can pass the `--dry-run` flag to scrape only the first 10 pages plus their redirects for testing purposes. **If you use the dry run command, be sure to run the full script without `--dry-run` before you commit the changes.**
42+
43+
## Step 3: Manually remove the search input from the archived docs
44+
45+
- [ ] Search for `site-search-input` in the compressed Javascript files (should find the file in the `_next` directory). When you find it, use something like https://beautifier.io/ or VSCode to reformat it to be readable. To reformat using VSCode, use the "Format document" option or <kbd>Shift</kbd>+<kbd>Option</kbd>+<kbd>F</kbd>. Find `site-search-input` in the file, the result will be enclosed in a function that looks something like... `(0,f.jsx)("input",{"data-testid":"site-search-input",` Delete the entire function. For example, this:
4146
```
42-
$ script/enterprise-server-deprecations/archive-version.js -p ../help-docs-archived-enterprise-versions
47+
(0, f.jsxs)("label", {
48+
className: "text-normal width-full",
49+
children: [(0, f.jsx)("span", {
50+
className: "visually-hidden",
51+
"aria-label": R($ || ($ = (0, k.Z)(["label"]))),
52+
"aria-describedby": R(W || (W = (0, k.Z)(["description"]))),
53+
children: R(U || (U = (0, k.Z)(["placeholder"])))
54+
}), (0, f.jsx)("input", {
55+
"data-testid": "site-search-input",
56+
ref: I,
57+
className: h()(pe().searchInput, 24 === p && pe().searchIconBackground24, 24 === p && "form-control px-6 f4", 16 === p && pe().searchIconBackground16, 16 === p && "form-control px-5 f4", "compact" === i && "py-2", "expanded" === i && "py-3", r && pe().searchInputHeader, !r && "width-full", r && j && pe().searchInputExpanded, r && j && "position-absolute top-0 right-0"),
58+
type: "search",
59+
placeholder: R(G || (G = (0, k.Z)(["placeholder"]))),
60+
autoComplete: _ ? "on" : "off",
61+
autoCorrect: "off",
62+
autoCapitalize: "off",
63+
spellCheck: "false",
64+
maxLength: 512,
65+
onChange: function(e) {
66+
S(e.target.value)
67+
},
68+
value: _,
69+
"aria-label": R(K || (K = (0, k.Z)(["label"]))),
70+
"aria-describedby": R(J || (J = (0, k.Z)(["description"])))
71+
})
4372
```
44-
**Note:** You can pass the `--dry-run` flag to scrape only the first 10 pages plus their redirects for testing purposes. **If you use the dry run command, be sure to run the full script without `--dry-run` before you commit the changes.**
4573

46-
## Step 2: Upload the assets directory to Azure storage
74+
becomes:
75+
76+
```
77+
(0, f.jsxs)('label', {
78+
className: 'text-normal width-full',
79+
children: [
80+
(0, f.jsx)('span', {
81+
className: 'visually-hidden',
82+
'aria-label': y(Q || (Q = (0, k.Z)(['label']))),
83+
'aria-describedby': y(X || (X = (0, k.Z)(['description']))),
84+
children: y(ee || (ee = (0, k.Z)(['placeholder']))),
85+
}),
86+
],
87+
}),
88+
```
89+
- [ ] Save the file. If using beautifier, copy and paste the updated file back into your temp directory with the scraped archive content.
90+
91+
## Step 2: Upload the scraped content directory to Azure storage
4792

4893
- [ ] Log in to the Azure portal from Okta. Navigate to the [githubdocs Azure Storage Blob resource](https://portal.azure.com/#@githubazure.onmicrosoft.com/resource/subscriptions/fa6134a7-f27e-4972-8e9f-0cedffa328f1/resourceGroups/docs-production/providers/Microsoft.Storage/storageAccounts/githubdocs/overview).
4994
- [ ] Click the "Open in Explorer" button to the right of search box. If you haven't already, click the download link to download "Microsoft Azure Storage Explorer." To login to the app, click the plug icon in the left sidebar and click the option to "add an azure account." When you login, you'll need a yubikey to authenticate through Okta.
50-
- [ ] From the Microsoft Azure Storage Explorer app, select the `githubdocs` storage account resource and navigate to the `github-images` blob container.
51-
- [ ] Click "Upload" and select "Upload folder." Click the "Selected folder" input to navigate to the `help-docs-archived-enterprise-versions` repository and select the `assets` directory for the version you just generated. In the "Destination directory" input, add the version number. For example, `/enterprise/2.22/`.
95+
- [ ] From the Microsoft Azure Storage Explorer app, select the `githubdocs` storage account resource and navigate to the `enterprise` blob container.
96+
- [ ] Click "Upload" and select "Upload folder." Click the "Selected folder" input to navigate to the temp directory you just generated. Inside that temp directory, select the `<VERSION_TO_DEPRECATE>` directory (e.g., `3.2`). Leave the destination directory input blank.
5297
- [ ] Check the log to ensure all files were uploaded successfully.
53-
- [ ] Remove the `assets` directory from your `help-docs-archived-enterprise-versions` repository, we don't want to commit that directory in the next step.
54-
55-
## Step 3: Commit and push changes to help-docs-archived-enterprise-versions repo
56-
57-
- [ ] Search for `site-search-input` in the compressed Javascript files (should find the file in the `_next` directory). When you find it, use something like https://beautifier.io/ or VSCode to reformat it to be readable. To reformat using VSCode, use the "Format document" option or <kbd>Shift</kbd>+<kbd>Option</kbd>+<kbd>F</kbd>. Find `site-search-input` in the file, the result will be enclosed in a function that looks something like... `1125: function () { ... },` Delete the innards of this function, but leave the `function() {}` part.
58-
- [ ] Save the file. If using beautifier, copy and paste the updated file back into your local `help-docs-archived-enterprise-versions` repository.
59-
- [ ] In your archival checkout, `git add <version>`, commit, and push.
60-
- [ ] Open a PR and merge it in. Note that the version will _not_ be deprecated on the docs site until you do the next step.
98+
- [ ] Remove the temporarily created directory from your `github/docs-internal` checkout.
6199

62100
## Step 4: Deprecate the version in docs-internal
63101

@@ -71,22 +109,13 @@ In your `docs-internal` checkout:
71109
You can test that the static pages were generated correctly on localhost and on staging. Verify that the static pages are accessible by running `npm run dev` in your local `docs-internal` checkout and navigate to:
72110
`http://localhost:3000/enterprise/<version>/`.
73111

74-
Note: the GitHub Pages deployment from the previous step will need to have completed successfully in order for you to test this. You may need to wait up to 10 minutes for this to occur.
75-
76112
Poke around several pages, ensure that the stylesheets are working properly, images are rendering properly, and that the search functionality was disabled.
77113

78-
## Step 5: Continue to deprecate the version in docs-internal
79-
80-
- [ ] Open a new PR. Make sure to check the following:
81-
- [ ] Tests are passing (you may need to include the changes in step 6 to get tests to pass).
82-
- [ ] The deprecated version renders in preview as expected. You should be able to navigate to `docs.github.com/enterprise/<DEPRECATED VERSION>` to access the docs. You should also be able to navigate to a page that is available in the deprecated version and change the version in the URL to the deprecated version, to test redirects.
83-
- [ ] The new oldest supported version renders on staging as expected. You should see a banner on the top of every page for the oldest supported version that notes when the version will be deprecated.
84-
85114
## Step 5: Remove static files for the version
86115

87116
- [ ] In your `docs-internal` checkout, create a new branch `remove-<version>-static-files` branch: `git checkout -b remove-<version>-static-files` (you can branch off of `main` or from your `deprecate-<version>` branch, up to you).
88117
- [ ] Run `script/enterprise-server-deprecations/remove-static-files.js` and commit results.
89-
- [ ] Run `script/enterprise-server-deprecations/remove-redirects.js` and commit results.
118+
- [ ] Re-generate the static files by running `script/rest/update-files.js --decorate-only`.
90119
- [ ] Open a new PR.
91120
- [ ] Get a review from docs-engineering and merge. This step can be merged independently from step 6. The purpose of splitting up steps 5 and 6 is to focus the review on specific files.
92121

@@ -107,3 +136,10 @@ Poke around several pages, ensure that the stylesheets are working properly, ima
107136
- [ ] When the PR is approved, [deploy the `github/github` PR](https://thehub.github.com/epd/engineering/devops/deployment/deploying-dotcom/). If you haven't deployed a `github/github` PR before, work with someone that has -- the process isn't too involved depending on how you deploy, but there are a lot of details that can potentially be confusing as you can see from the documentation.
108137

109138
**Note**: you can do this step independently of the other steps after a GHES version is deprecated since it should no longer get updates in github/github. You should plan to get this PR merged as soon as possible, otherwise if you wait too long our OpenAPI automation may re-add the static files that you removed in step 5.
139+
140+
## Step 5: Continue to deprecate the version in docs-internal
141+
142+
- [ ] Open a new PR. Make sure to check the following:
143+
- [ ] Tests are passing (you may need to include the changes in step 6 to get tests to pass).
144+
- [ ] The deprecated version renders in preview as expected. You should be able to navigate to `docs.github.com/enterprise/<DEPRECATED VERSION>` to access the docs. You should also be able to navigate to a page that is available in the deprecated version and change the version in the URL to the deprecated version, to test redirects.
145+
- [ ] The new oldest supported version renders on staging as expected. You should see a banner on the top of every page for the oldest supported version that notes when the version will be deprecated.

.github/actions/lib/get-env-inputs.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,22 @@ export function getEnvInputs(options) {
1616
})
1717
)
1818
}
19+
20+
/*
21+
* Given an environment variable key, return `true` or `false` if the
22+
* value is recognizable.
23+
* Turn 'true' or '1' into `true`. And '', '0', or 'false' into `false`.
24+
* All other values are invalid.
25+
* Now you can't accidentally set `export FOO=falsee` which as string `'falsee'`
26+
* could have been interpreted as a truthy value.
27+
*
28+
* @param {string} key - name of the environment variable
29+
*
30+
* @returns {boolean}
31+
*/
32+
export function boolEnvVar(key) {
33+
const value = process.env[key] || ''
34+
if (value === '' || value === 'false' || value === '0') return false
35+
if (value === 'true' || value === '1') return true
36+
throw new Error(`Invalid value for set environment variable ${key}: '${value}'`)
37+
}

.github/actions/rendered-content-link-checker.js

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import warmServer from '../../lib/warm-server.js'
1414
import renderContent from '../../lib/render-content/index.js'
1515
import { deprecated } from '../../lib/enterprise-server-releases.js'
1616
import excludedLinks from '../../lib/excluded-links.js'
17-
import { getEnvInputs } from './lib/get-env-inputs.js'
17+
import { getEnvInputs, boolEnvVar } from './lib/get-env-inputs.js'
1818
import { debugTimeEnd, debugTimeStart } from './lib/debug-time-taken.js'
1919
import { uploadArtifact as uploadArtifactLib } from './lib/upload-artifact.js'
2020
import github from '../../script/helpers/github.js'
@@ -52,19 +52,8 @@ const deprecatedVersionPrefixesRegex = new RegExp(
5252
// When this file is invoked directly from action as opposed to being imported
5353
if (import.meta.url.endsWith(process.argv[1])) {
5454
// Optional env vars
55-
const {
56-
ACTION_RUN_URL,
57-
CREATE_REPORT,
58-
CHECK_EXTERNAL_LINKS,
59-
LEVEL,
60-
SHOULD_COMMENT,
61-
COMMENT_LIMIT_TO_EXTERNAL_LINKS,
62-
FAIL_ON_FLAW,
63-
FILES_CHANGED,
64-
REPORT_REPOSITORY,
65-
REPORT_AUTHOR,
66-
REPORT_LABEL,
67-
} = process.env
55+
const { ACTION_RUN_URL, LEVEL, FILES_CHANGED, REPORT_REPOSITORY, REPORT_AUTHOR, REPORT_LABEL } =
56+
process.env
6857

6958
const octokit = github()
7059

@@ -86,15 +75,15 @@ if (import.meta.url.endsWith(process.argv[1])) {
8675
verbose: true,
8776
linkReports: true,
8877
checkImages: true,
89-
patient: true,
78+
patient: boolEnvVar('PATIENT'),
9079
random: false,
9180
language: 'en',
9281
actionUrl: ACTION_RUN_URL,
93-
checkExternalLinks: CHECK_EXTERNAL_LINKS === 'true',
94-
shouldComment: Boolean(JSON.parse(SHOULD_COMMENT)),
95-
commentLimitToExternalLinks: COMMENT_LIMIT_TO_EXTERNAL_LINKS === 'true',
96-
failOnFlaw: FAIL_ON_FLAW === 'true',
97-
createReport: CREATE_REPORT === 'true',
82+
checkExternalLinks: boolEnvVar('CHECK_EXTERNAL_LINKS'),
83+
shouldComment: boolEnvVar('SHOULD_COMMENT'),
84+
commentLimitToExternalLinks: boolEnvVar('COMMENT_LIMIT_TO_EXTERNAL_LINKS'),
85+
failOnFlaw: boolEnvVar('FAIL_ON_FLAW'),
86+
createReport: boolEnvVar('CREATE_REPORT'),
9887
reportRepository: REPORT_REPOSITORY,
9988
reportLabel: REPORT_LABEL,
10089
reportAuthor: REPORT_AUTHOR,
@@ -140,6 +129,7 @@ if (import.meta.url.endsWith(process.argv[1])) {
140129
* verbose {boolean} - Set to true for more verbose logging
141130
* random {boolean} - Randomize page order for debugging when true
142131
* patient {boolean} - Wait longer and retry more times for rate-limited external URLS
132+
* bail {boolean} - Throw an error on the first page (not permalink) that has >0 flaws
143133
*
144134
*/
145135
async function main(core, octokit, uploadArtifact, opts = {}) {
@@ -529,7 +519,7 @@ function getPages(pageList, languages, filters, files, max) {
529519
}
530520

531521
async function processPage(core, page, pageMap, redirects, opts) {
532-
const { verbose, verboseUrl } = opts
522+
const { verbose, verboseUrl, bail } = opts
533523

534524
const allFlawsEach = await Promise.all(
535525
page.permalinks.map((permalink) => {
@@ -543,6 +533,13 @@ async function processPage(core, page, pageMap, redirects, opts) {
543533
if (verbose) {
544534
printFlaws(core, allFlaws, { verboseUrl })
545535
}
536+
537+
if (bail) {
538+
if (!verbose) {
539+
console.warn('Use --verbose to see the flaws before it exits')
540+
}
541+
throw new Error(`More than one flaw in ${page.relativePath}`)
542+
}
546543
}
547544

548545
return allFlaws
@@ -831,7 +828,7 @@ async function innerFetch(core, url, config = {}) {
831828
// So there's no point in trying more attempts than 3 because it would
832829
// just timeout on the 10s. (i.e. 1000 + 2000 + 4000 + 8000 > 10,000)
833830
const retry = {
834-
limit: patient ? 5 : 2,
831+
limit: patient ? 6 : 2,
835832
}
836833
const timeout = { request: patient ? 10000 : 2000 }
837834

.github/workflows/link-check-daily.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
REPORT_REPOSITORY: github/docs-content
4646
CREATE_REPORT: true
4747
CHECK_EXTERNAL_LINKS: true
48+
PATIENT: true
4849
timeout-minutes: 30
4950
run: node .github/actions/rendered-content-link-checker.js
5051

.github/workflows/orphaned-assets-check.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,46 @@ jobs:
1717
if: ${{ github.repository == 'github/docs-internal' }}
1818
runs-on: ubuntu-latest
1919
steps:
20-
- name: Checkout
20+
- name: Checkout English repo
2121
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
2222
with:
2323
# Using a PAT is necessary so that the new commit will trigger the
2424
# CI in the PR. (Events from GITHUB_TOKEN don't trigger new workflows.)
2525
token: ${{ secrets.DOCUBOT_REPO_PAT }}
2626

27+
# TODO: Can be removed after we no longer keep translations in-repo
28+
- name: Remove existing language translations
29+
run: |
30+
rm -rf translations
31+
32+
- name: Checkout the es-es repo
33+
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
34+
with:
35+
repository: github/docs-internal.es-es
36+
token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
37+
path: translations/es-ES
38+
39+
- name: Checkout the pt-br repo
40+
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
41+
with:
42+
repository: github/docs-internal.pt-br
43+
token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
44+
path: translations/pt-BR
45+
46+
- name: Checkout the zh-cn repo
47+
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
48+
with:
49+
repository: github/docs-internal.zh-cn
50+
token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
51+
path: translations/zh-CN
52+
53+
- name: Checkout the ja-jp repo
54+
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748
55+
with:
56+
repository: github/docs-internal.ja-jp
57+
token: ${{ secrets.DOCUBOT_READORG_REPO_WORKFLOW_SCOPES }}
58+
path: translations/ja-JP
59+
2760
- name: Setup node
2861
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048
2962
with:
@@ -43,7 +76,7 @@ jobs:
4376
./script/find-orphaned-assets.js | xargs git rm
4477
4578
# If nothing to commit, exit now. It's fine. No orphans.
46-
git status | grep 'nothing to commit' && exit 0
79+
git status -- ':!translations*' | grep 'nothing to commit' && exit 0
4780
4881
# Replicated from the translation pipeline PR-maker Action
4982
git config --global user.name "docubot"

0 commit comments

Comments
 (0)