Skip to content

Commit cf0b43b

Browse files
authored
Merge branch 'main' into patch-2
2 parents f742d82 + 99c1aa7 commit cf0b43b

File tree

736 files changed

+7711
-13015
lines changed

Some content is hidden

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

736 files changed

+7711
-13015
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Closes [issue link]
2020

2121
### What's being changed:
2222

23-
<!-- Share artifacts of the changes, be they code snippets, GIFs or screenshots; whatever shares the most context. -->
23+
<!-- Share artifacts of the changes, be they code snippets, GIFs or screenshots; whatever shares the most context. If you made changes to the `content` directory, a table will populate in a comment below with the staging and live article links -->
2424

2525
### Check off the following:
2626

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,7 @@ If you aren't comfortable going through the steps alone, sync up with a docs eng
4747
```
4848
4949
**Note:** All of the content in this file will be updated when the release notes are created in the megabranch including the filename `PLACEHOLDER.yml`. You can update the date or leave it as-is and wait to update it when the release notes are finalized.
50-
- [ ] Create the search indices for the new release:
5150
52-
```
53-
npm run sync-search-ghes-release
54-
```
55-
56-
Check in the updated `lib/search/cached-index-names.json`.
5751
- [ ] (Optional) Add a Release Candidate banner:
5852
5953
```

.github/actions-scripts/openapi-schema-branch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const changedFiles = execSync('git diff --name-only HEAD').toString()
3636
if (changedFiles !== '') {
3737
console.log(`These files were changed:\n${changedFiles}`)
3838
console.log(
39-
`🚧⚠️ Your decorated and dereferenced schema files don't match. Ensure you're using decorated and dereferenced schemas from the automatically created pull requests by the 'github-openapi-bot' user. For more information, see 'script/rest/README.md'. 🛑`
39+
`🚧⚠️ Your decorated and dereferenced schema files don't match. Ensure you're using decorated and dereferenced schemas from the automatically created pull requests by the 'github-openapi-bot' user. \n\n If this test is failing after updates to the script/rest directory, run script/rest/update-files.js --decorate-only to re-generate the decorated files from the existing dereferenced files and check those in. \n\n If this test is failing after an update to a package, check the changes the new package makes to the decorated files by running script/rest/update-files.js --decorate-only. If the changes are small style changes that don't impact the overall experience, check the updated decorated file in. Otherwise, more work may be needed to be compatible with the updated package. \n\n For more information, see 'script/rest/README.md'. 🛑`
4040
)
4141
process.exit(1)
4242
}

.github/allowed-actions.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ export default [
99
'actions/labeler@5f867a63be70efff62b767459b009290364495eb', // v2.2.0
1010
'actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f', // v2.2.0
1111
'actions/stale@9d6f46564a515a9ea11e7762ab3957ee58ca50da', // v3.0.16
12+
'actions/upload-artifact@27121b0bdffd731efa15d66772be8dc71245d074', // v2.2.4
1213
'alex-page/github-project-automation-plus@fdb7991b72040d611e1123d2b75ff10eda9372c9',
1314
'andymckay/labeler@22d5392de2b725cea4b284df5824125054049d84',
1415
'crowdin/github-action@fd9429dd63d6c0f8a8cb4b93ad8076990bd6e688',
1516
'crykn/copy_folder_to_another_repo_action@0282e8b9fef06de92ddcae9fe6cb44df6226646c',
1617
'cschleiden/actions-linter@caffd707beda4fc6083926a3dff48444bc7c24aa', // uses github-actions-parser v0.23.0
17-
'dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911',
18+
'dawidd6/action-delete-branch@47743101a121ad657031e6704086271ca81b1911', // v3.0.2
19+
'dawidd6/action-download-artifact@b9571484721e8187f1fd08147b497129f8972c74', // v2.14.0
1820
'docker://chinthakagodawita/autoupdate-action:v1',
1921
'dorny/paths-filter@eb75a1edc117d3756a18ef89958ee59f9500ba58',
2022
'github/codeql-action/analyze@v1',
@@ -27,11 +29,13 @@ export default [
2729
'peter-evans/create-issue-from-file@b4f9ee0a9d4abbfc6986601d9b1a4f8f8e74c77e',
2830
'peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd',
2931
'peter-evans/create-pull-request@8c603dbb04b917a9fc2dd991dc54fef54b640b43',
32+
'peter-evans/find-comment@0da1f4fc1f20cd898368bd56089d391df418f52f',
3033
'rachmari/actions-add-new-issue-to-column@1a459ef92308ba7c9c9dc2fcdd72f232495574a9',
3134
'rachmari/labeler@832d42ec5523f3c6d46e8168de71cd54363e3e2e',
3235
'repo-sync/github-sync@3832fe8e2be32372e1b3970bbae8e7079edeec88',
3336
'repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d',
3437
'someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd',
3538
'tjenkinson/gh-action-auto-merge-dependency-updates@4d7756c04d9d999c5968697a621b81c47f533d61',
39+
'Bhacaz/checkout-files@c8f01756bfd894ba746d5bf48205e19000b0742b', // v1.0.0
3640
'EndBug/add-and-commit@2bdc0a61a03738a1d1bda24d566ad0dbe3083d87',
3741
]

.github/workflows/check-for-spammy-issues.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
const repo = 'docs'
2424
2525
const titleWordCount = issue.title.trim().split(' ').length
26-
const titleWordCountMin = 2
26+
const titleWordCountMin = 3
2727
2828
try {
2929
await github.teams.getMembershipForUserInOrg({
@@ -35,18 +35,18 @@ jobs:
3535
// Do not perform this workflow with GitHub employees. This return
3636
// statement only gets hit if the user is a GitHub employee
3737
return
38-
} catch(err) {
38+
} catch (err) {
3939
// An error will be thrown if the user is not a GitHub employee
4040
// If a user is not a GitHub employee, we should check to see if title has at least the minimum required number of words in it and if it does, we can exit the workflow
4141
42-
if(titleWordCount > titleWordCountMin) {
42+
if (titleWordCount >= titleWordCountMin) {
4343
return
4444
}
4545
}
4646
4747
//
4848
// Assuming the user is not a GitHub employee and the issue title
49-
// has the minimum number of words required, proceed.
49+
// does not contain the minimum number of words required, proceed.
5050
//
5151
5252
// Close the issue and add the invalid label
@@ -63,7 +63,7 @@ jobs:
6363
owner: owner,
6464
repo: repo,
6565
issue_number: issue.number,
66-
body: "This issue appears to have been opened accidentally. I'm going to close it now, but feel free to open a new issue or ask any questions in [discussions](https://github.com/github/docs/discussions)!"
66+
body: `This issue may have been opened accidentally. I'm going to close it now, but feel free to open a new issue with a more descriptive title or ask any questions in [discussions](https://github.com/github/docs/discussions)!`
6767
});
6868
6969
// Add the issue to the Done column on the triage board
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Content Changes Table Comment
2+
3+
# **What it does**: When a PR is opened in docs-internal or docs, it adds the staging preview and live article links in a Content Directory Changes table in a comment
4+
# **Why we have it**: To help Docs Content team members and contributors automatically have their staging/live article links added to the table
5+
# **Who does it impact**: docs-internal/docs maintainers and contributors
6+
7+
on:
8+
workflow_dispatch:
9+
pull_request_target:
10+
types: [opened, synchronize, reopened]
11+
12+
jobs:
13+
PR-Preview-Links:
14+
name: Add staging/live links to PR
15+
runs-on: ubuntu-latest
16+
outputs:
17+
filterContentDir: ${{ steps.filter.outputs.filterContentDir }}
18+
steps:
19+
- name: Get files changed
20+
uses: dorny/paths-filter@eb75a1edc117d3756a18ef89958ee59f9500ba58
21+
id: filter
22+
with:
23+
# Base branch used to get changed files
24+
base: ${{ github.event.pull_request.base.ref }}
25+
26+
# Enables setting an output in the format in `${FILTER_NAME}_files
27+
# with the names of the matching files formatted as JSON array
28+
list-files: json
29+
30+
# Returns list of changed files matching each filter
31+
filters: |
32+
filterContentDir:
33+
- 'content/**/*'
34+
filterContentDir:
35+
needs: PR-Preview-Links
36+
if: ${{ needs.PR-Preview-Links.outputs.filterContentDir == 'true' }}
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: check out repo content
40+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
41+
42+
- name: Setup Node
43+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f
44+
with:
45+
node-version: 16.x
46+
cache: npm
47+
48+
- name: Install dependencies
49+
run: npm ci
50+
51+
- name: Get changes table
52+
uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
53+
id: changes
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
script: |
58+
const slugify = require('github-slugger').slug
59+
60+
const HEROKU_APPNAME_MAX_LENGTH = 30
61+
62+
const repoName = context.payload.repository.name
63+
const branchName = context.payload.pull_request.head.ref
64+
const prNumber = context.payload.number
65+
const stagingPrefix = getStagingPrefix(repoName, prNumber, branchName)
66+
67+
const response = await github.repos.compareCommits({
68+
owner: context.repo.owner,
69+
repo: context.repo.repo,
70+
base: context.payload.pull_request.base.sha,
71+
head: context.payload.pull_request.head.sha
72+
})
73+
74+
let changedFiles = response.data.files
75+
.map(e => e.filename)
76+
.filter(file => file.startsWith('content/') && !file.includes('index'))
77+
78+
let markdownTable = '| **Article in Staging** | **Live Article** | **Source** | **Changes** |\n| ----------- | ----------- | ----------- | ----------- |\n'
79+
for (let file of changedFiles) {
80+
file = file.split('content')[1]
81+
const fileURL = file.substring(0, file.length-3)
82+
const stagingLink = `https://${stagingPrefix}.herokuapp.com${fileURL}`
83+
let fileTitle = file.split('/').pop()
84+
fileTitle = fileTitle.substring(0, fileTitle.length - 3)
85+
const markdownLine = '| [' + fileTitle + '](' + stagingLink + ') | [' + fileTitle + '](https://docs.github.com' + fileURL + ') | | |\n'
86+
markdownTable += markdownLine
87+
}
88+
89+
function getStagingPrefix (prefix, prNumber, branch) {
90+
// Added a - in front of prNumber
91+
return `${prefix}-${prNumber}--${slugify(branch)}`
92+
.toLowerCase()
93+
.slice(0, HEROKU_APPNAME_MAX_LENGTH)
94+
.replace(/_/g, '-')
95+
.replace(/-+$/, '')
96+
}
97+
core.setOutput('changesTable', markdownTable)
98+
99+
- name: Find content directory changes comment
100+
uses: peter-evans/find-comment@0da1f4fc1f20cd898368bd56089d391df418f52f
101+
id: findComment
102+
with:
103+
issue-number: ${{ github.event.pull_request.number }}
104+
comment-author: 'github-actions[bot]'
105+
body-includes: '## ⚠️ Automatically generated comment ⚠️'
106+
107+
- name: Update comment
108+
uses: peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd
109+
with:
110+
comment-id: ${{ steps.findComment.outputs.comment-id }}
111+
issue-number: ${{ github.event.pull_request.number }}
112+
body: |
113+
## ⚠️ Automatically generated comment ⚠️
114+
**This comment is automatically generated and will be overwritten the every time changes are committed to this branch.**
115+
116+
The table contains an overview of files in the `content` directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the `data` directory will not show up in this table.
117+
118+
---
119+
120+
### Content directory changes
121+
_You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request._
122+
${{ steps.changes.outputs.changesTable }}
123+
edit-mode: replace

.github/workflows/merged-notification.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
comment:
14-
if: github.repository == 'github/docs' && github.event.pull_request.merged && github.event.pull_request.base.ref == github.event.repository.default_branch
14+
if: github.repository == 'github/docs' && github.event.pull_request.merged && github.event.pull_request.base.ref == github.event.repository.default_branch && github.event.pull_request.user.login != 'Octomerger'
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d

.github/workflows/openapi-schema-check.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
name: OpenAPI dev mode check
22

3-
# **What it does**:
4-
# **Why we have it**:
5-
# **Who does it impact**:
3+
# **What it does**: Checks that the files in lib/rest/static/decorated match
4+
# the files in lib/rest/static/dereferenced. Checks that the decorated
5+
# schemas in lib/rest/static/decorated are not in development mode.
6+
# Development mode schemas have a branch name and development mode tag in the
7+
# info.version property.
8+
# **Why we have it**: To ensure that we aren't every shipping decorated schemas
9+
# that are out of sync with the source derefereced schema. To ensure that
10+
# decorated schemas generated locally are not published. Locally generated
11+
# decorated schemas are pushing up to the remote for staging purposes only.
12+
# **Who does it impact**: Docs content writers updating REST API docs and
13+
# the docs engineering team as maintainers of the scripts and workflows.
614

715
on:
816
workflow_dispatch:
@@ -12,6 +20,8 @@ on:
1220
pull_request:
1321
paths:
1422
- 'lib/rest/static/**'
23+
- 'script/rest/**/*.js'
24+
- 'package*.json'
1525

1626
jobs:
1727
check-schema-versions:
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Staging - Build PR
2+
3+
# **What it does**: Builds PRs before deploying them.
4+
# **Why we have it**: Because it's not safe to share our deploy secrets with forked repos: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
5+
# **Who does it impact**: All contributors.
6+
7+
on:
8+
pull_request:
9+
types:
10+
- opened
11+
- reopened
12+
- synchronize
13+
- unlocked
14+
15+
jobs:
16+
build:
17+
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
18+
name: Build
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 5
21+
concurrency:
22+
group: staging_${{ github.head_ref }}
23+
cancel-in-progress: true
24+
steps:
25+
- name: Check out repo
26+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
27+
28+
- name: Setup node
29+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f
30+
with:
31+
node-version: 16.x
32+
cache: npm
33+
34+
# Required for `npm pkg ...` command support
35+
- name: Update to npm@^7.20.0
36+
run: npm install --global npm@^7.20.0
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
41+
- name: Build
42+
run: npm run build
43+
44+
- name: Remove development-only dependencies
45+
run: npm prune --production
46+
47+
- name: Remove all npm scripts
48+
run: npm pkg delete scripts
49+
50+
- name: Set npm script for Heroku build to noop
51+
run: npm set-script heroku-postbuild "echo 'Application was pre-built!'"
52+
53+
- name: Create an archive
54+
run: |
55+
tar -cf app.tar \
56+
node_modules/ \
57+
.next/ \
58+
assets/ \
59+
content/ \
60+
data/ \
61+
includes/ \
62+
lib/ \
63+
middleware/ \
64+
translations/ \
65+
server.mjs \
66+
package*.json \
67+
feature-flags.json \
68+
next.config.js \
69+
app.json \
70+
Procfile
71+
72+
# Upload only the files needed to run this application.
73+
# We are not willing to trust the rest (e.g. script/) for the remainder
74+
# of the deployment process.
75+
- name: Upload build artifact
76+
uses: actions/upload-artifact@27121b0bdffd731efa15d66772be8dc71245d074
77+
with:
78+
name: pr_build
79+
path: app.tar
80+
81+
- name: Send Slack notification if workflow fails
82+
uses: someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd
83+
if: ${{ failure() }}
84+
with:
85+
channel: ${{ secrets.DOCS_STAGING_DEPLOYMENT_FAILURES_SLACK_CHANNEL_ID }}
86+
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
87+
color: failure
88+
text: Staging build failed for PR ${{ github.event.pull_request.html_url }} at commit ${{ github.sha }}. See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

0 commit comments

Comments
 (0)