Skip to content

Commit 36f73f3

Browse files
author
Kathy Korevec
authored
Merge branch 'main' into patch-1
2 parents 3a1ecd7 + cbbe42b commit 36f73f3

File tree

3,233 files changed

+2382163
-143724
lines changed

Some content is hidden

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

3,233 files changed

+2382163
-143724
lines changed

.env.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
ALGOLIA_API_KEY=
22
ALGOLIA_APPLICATION_ID=
33
ALLOW_TRANSLATION_COMMITS=
4-
EARLY_ACCESS_HOSTNAME=
5-
EARLY_ACCESS_SHARED_SECRET=
6-
GITHUB_TOKEN=

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ package.json @github/docs-engineering
2020
# Site Policy
2121
/content/github/site-policy/ @github/site-policy-admins
2222

23+
# Content strategy
24+
/contributing/content-markup-reference.md @github/product-docs-content-strategy
25+
/contributing/content-style-guide.md @github/product-docs-content-strategy
26+
2327
# Make sure that Octokit maintainers get notified about changes
2428
# relevant to the Octokit libraries (https://github.com/octokit)
2529
/content/rest/reference @github/octokit-maintainers

.github/ISSUE_TEMPLATE/improve-existing-docs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ labels:
77
assignees: ''
88
---
99
<!--
10-
HUBBERS BEWARE! THE GITHUB/DOCS REPO IS PUBLIC TO THE ENTIRE INTERNET. OPEN AN ISSUE IN GITHUB/DOCS-CONTENT https://github.com/github/docs-content/issues/new/choose INSTEAD.
10+
HUBBERS BEWARE! THE GITHUB/DOCS REPO IS PUBLIC TO THE ENTIRE INTERNET. OPEN AN ISSUE IN GITHUB/DOCS-CONTENT INSTEAD.
1111
-->
1212

1313
<!--
1414
For questions, ask in Discussions: https://github.com/github/docs/discussions
1515
16-
Before you file an issue read the:
16+
Before you file an issue read the:
1717
- Code of Conduct: https://github.com/github/docs/blob/main/CODE_OF_CONDUCT.md
1818
- Contributing guide: https://github.com/github/docs/blob/main/CONTRIBUTING.md
1919

.github/ISSUE_TEMPLATE/improve-the-site.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ assignees: ''
77
---
88

99
<!--
10-
HUBBERS BEWARE! THE GITHUB/DOCS REPO IS PUBLIC TO THE ENTIRE INTERNET. OPEN AN ISSUE IN GITHUB/DOCS-CONTENT https://github.com/github/docs-content/issues/new/choose INSTEAD.
10+
HUBBERS BEWARE! THE GITHUB/DOCS REPO IS PUBLIC TO THE ENTIRE INTERNET. OPEN AN ISSUE IN GITHUB/DOCS-CONTENT INSTEAD.
1111
-->
1212

1313
<!--
1414
For questions, ask in Discussions: https://github.com/github/docs/discussions
1515
16-
Before you file an issue read the:
16+
Before you file an issue read the:
1717
- Code of Conduct: https://github.com/github/docs/blob/main/CODE_OF_CONDUCT.md
1818
- Contributing guide: https://github.com/github/docs/blob/main/CONTRIBUTING.md
1919
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs')
4+
const core = require('@actions/core')
5+
const eventPayload = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'))
6+
7+
// This workflow-run script does the following:
8+
// 1. Gets an array of labels on a PR.
9+
// 2. Finds one with the relevant Algolia text; if none found, exits early.
10+
// 3. Gets the version substring from the label string.
11+
12+
const labelText = 'sync-english-index-for-'
13+
const labelsArray = eventPayload.pull_request.labels
14+
15+
// Exit early if no labels are on this PR
16+
if (!(labelsArray && labelsArray.length)) {
17+
process.exit(0)
18+
}
19+
20+
// Find the relevant label
21+
const algoliaLabel = labelsArray
22+
.map(label => label.name)
23+
.find(label => label.startsWith(labelText))
24+
25+
// Exit early if no relevant label is found
26+
if (!algoliaLabel) {
27+
process.exit(0)
28+
}
29+
30+
// Given: sync-english-index-for-enterprise-server@3.0
31+
// Returns: enterprise-server@3.0
32+
const versionToSync = algoliaLabel.split(labelText)[1]
33+
34+
// Store the version so we can access it later in the workflow
35+
core.setOutput('versionToSync', versionToSync)
36+
process.exit(0)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs')
4+
const path = require('path')
5+
const { execSync } = require('child_process')
6+
const semver = require('semver')
7+
8+
/*
9+
* This script performs two checks to prevent shipping development mode OpenAPI schemas:
10+
* - Ensures the `info.version` property is a semantic version.
11+
* In development mode, the `info.version` property is a string
12+
* containing the `github/github` branch name.
13+
* - Ensures the decorated schema matches the dereferenced schema.
14+
* The workflow that calls this script runs `script/rest/update-files.js`
15+
* with the `--decorate-only` switch then checks to see if files changed.
16+
*
17+
*/
18+
19+
// Check that the `info.version` property is a semantic version
20+
const dereferencedDir = path.join(process.cwd(), 'lib/rest/static/dereferenced')
21+
const schemas = fs.readdirSync(dereferencedDir)
22+
schemas.forEach(filename => {
23+
const schema = require(path.join(dereferencedDir, filename))
24+
if (!semver.valid(schema.info.version)) {
25+
console.log(`🚧⚠️ Your branch contains a development mode OpenAPI schema: ${schema.info.version}. This check is a reminder to not 🚢 OpenAPI files in development mode. 🛑`)
26+
process.exit(1)
27+
}
28+
})
29+
30+
// Check that the decorated schema matches the dereferenced schema
31+
const changedFiles = execSync('git diff --name-only HEAD').toString()
32+
33+
if(changedFiles !== '') {
34+
console.log(`These files were changed:\n${changedFiles}`)
35+
console.log(`🚧⚠️ 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'. 🛑`)
36+
process.exit(1)
37+
}
38+
39+
// All checks pass, ready to ship
40+
console.log('All good 👍')
41+
process.exit(0)

.github/allowed-actions.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ module.exports = [
2121
'juliangruber/approve-pull-request-action@c530832d4d346c597332e20e03605aa94fa150a8',
2222
'juliangruber/find-pull-request-action@64d55773c959748ad30a4184f4dc102af1669f7b',
2323
'juliangruber/read-file-action@e0a316da496006ffd19142f0fd594a1783f3b512',
24+
'lee-dohm/close-matching-issues@22002609b2555fe18f52b8e2e7c07cbf5529e8a8',
2425
'pascalgn/automerge-action@c9bd182',
2526
'peter-evans/create-issue-from-file@a04ce672e3acedb1f8e416b46716ddfd09905326',
27+
'peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd',
2628
'peter-evans/create-pull-request@938e6aea6f8dbdaced2064e948cb806c77fe87b8',
2729
'rachmari/actions-add-new-issue-to-column@1a459ef92308ba7c9c9dc2fcdd72f232495574a9',
2830
'rachmari/labeler@832d42ec5523f3c6d46e8168de71cd54363e3e2e',
2931
'repo-sync/github-sync@3832fe8e2be32372e1b3970bbae8e7079edeec88',
3032
'repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d',
31-
'rtCamp/action-slack-notify@e17352feaf9aee300bf0ebc1dfbf467d80438815',
32-
'tjenkinson/gh-action-auto-merge-dependency-updates@cee2ac0'
33+
'someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd',
34+
'tjenkinson/gh-action-auto-merge-dependency-updates@cee2ac0',
35+
'EndBug/add-and-commit@9358097a71ad9fb9e2f9624c6098c89193d83575'
3336
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: autoupdate reposync branch on cron
2+
on:
3+
schedule:
4+
- cron: '*/5 * * * *'
5+
jobs:
6+
autoupdate:
7+
name: autoupdate
8+
runs-on: ubuntu-18.04
9+
steps:
10+
- uses: docker://chinthakagodawita/autoupdate-action:v1
11+
env:
12+
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
13+
PR_FILTER: labelled
14+
PR_LABELS: 'automated-reposync-pr'
15+
MERGE_MSG: "Branch was updated using the 'autoupdate reposync branch on cron' Actions workflow."

.github/workflows/check-all-english-links.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,32 @@ jobs:
1717
- name: npm run build
1818
run: npm run build
1919
- name: Run script
20-
run: script/check-english-links.js > broken_links.md
20+
run: |
21+
script/check-english-links.js > broken_links.md
2122
- if: ${{ failure() }}
2223
name: Get title for issue
2324
id: check
2425
run: echo "::set-output name=title::$(head -1 broken_links.md)"
26+
- if: ${{ failure() }}
27+
name: Close previous report
28+
uses: lee-dohm/close-matching-issues@22002609b2555fe18f52b8e2e7c07cbf5529e8a8
29+
with:
30+
query: 'label:"broken link report"'
31+
token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
2532
- if: ${{ failure() }}
2633
name: Create issue from file
34+
id: broken-link-report
2735
uses: peter-evans/create-issue-from-file@a04ce672e3acedb1f8e416b46716ddfd09905326
2836
with:
2937
token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
3038
title: ${{ steps.check.outputs.title }}
3139
content-filepath: ./broken_links.md
3240
labels: broken link report
41+
- if: ${{ failure() }}
42+
name: Add comment to issue
43+
uses: peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd
44+
with:
45+
body: |
46+
cc @github/docs-content
47+
issue-number: ${{ steps.broken-link-report.outputs.issue-number }}
48+
token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Close unwanted pull requests
2+
on:
3+
pull_request:
4+
paths:
5+
- '.github/workflows/**'
6+
- '.github/CODEOWNERS'
7+
- 'translations/**'
8+
- 'assets/fonts/**'
9+
- 'data/graphql/**'
10+
- 'lib/graphql/**'
11+
- 'lib/redirects/**'
12+
- 'lib/webhooks/**'
13+
jobs:
14+
close_unwanted_pull_requests:
15+
if: github.repository == 'github/docs' && github.event.pull_request.user.login != 'Octomerger'
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
19+
with:
20+
script: |
21+
await github.issues.createComment({
22+
...context.repo,
23+
issue_number: context.payload.pull_request.number,
24+
body:
25+
`Thanks for contributing! We do not accept community changes to these files at this time.
26+
- '.github/workflows/**'
27+
- '.github/CODEOWNERS'
28+
- 'translations/**'
29+
- 'assets/fonts/**'
30+
- 'data/graphql/**'
31+
- 'lib/graphql/**'
32+
- 'lib/redirects/**'
33+
- 'lib/webhooks/**'`
34+
})
35+
await github.issues.update({
36+
...context.repo,
37+
issue_number: context.payload.pull_request.number,
38+
state: 'closed'
39+
})
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Confirm internal staff meant to post in public
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
- reopened
8+
- transferred
9+
pull_request_target:
10+
types:
11+
- opened
12+
- reopened
13+
14+
jobs:
15+
check-team-membership:
16+
runs-on: ubuntu-latest
17+
continue-on-error: true
18+
if: github.repository == 'github/docs'
19+
steps:
20+
- uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
21+
with:
22+
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
23+
script: |
24+
// Only perform this action with GitHub employees
25+
try {
26+
await github.teams.getMembershipForUserInOrg({
27+
org: 'github',
28+
team_slug: 'employees',
29+
username: context.payload.sender.login,
30+
});
31+
} catch(err) {
32+
// An error will be thrown if the user is not a GitHub employee
33+
// If a user is not a GitHub employee, we should stop here and
34+
// Not send a notification
35+
return
36+
}
37+
38+
// Don't perform this action with Docs team members
39+
try {
40+
await github.teams.getMembershipForUserInOrg({
41+
org: 'github',
42+
team_slug: 'docs',
43+
username: context.payload.sender.login,
44+
});
45+
// If the user is a Docs team member, we should stop here and not send
46+
// a notification
47+
return
48+
} catch(err) {
49+
// An error will be thrown if the user is not a Docs team member
50+
// If a user is not a Docs team member we should continue and send
51+
// the notification
52+
}
53+
54+
const issueNo = context.number || context.issue.number
55+
56+
// Create an issue in our private repo
57+
await github.issues.create({
58+
owner: 'github',
59+
repo: 'docs-internal',
60+
title: `@${context.payload.sender.login} confirm that \#${issueNo} should be in the public github/docs repo`,
61+
body: `@${context.payload.sender.login} opened https://github.com/github/docs/issues/${issueNo} publicly in the github/docs repo, instead of the private github/docs-internal repo.\n\n@${context.payload.sender.login}, please confirm that this belongs in the public repo and that no sensitive information was disclosed by commenting below and closing the issue.\n\nIf this was not intentional and sensitive information was shared, please delete https://github.com/github/docs/issues/${issueNo} and notify us in the \#docs-open-source channel.\n\nThanks! \n\n/cc @github/docs @github/docs-engineering`
62+
});
63+
64+
throw new Error('A Hubber opened an issue on the public github/docs repo');
65+
66+
- name: Send Slack notification if a GitHub employee who isn't on the docs team opens an issue in public
67+
if: ${{ failure() && github.repository == 'github/docs' }}
68+
uses: someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd
69+
with:
70+
channel: ${{ secrets.DOCS_OPEN_SOURCE_SLACK_CHANNEL_ID }}
71+
bot-token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
72+
text: <@${{github.actor}}> opened https://github.com/github/docs/issues/${{ github.event.number || github.event.issue.number }} publicly on the github/docs repo instead of the private github/docs-internal repo. They have been notified via a new issue in the github/docs-internal repo to confirm this was intentional.

.github/workflows/js-lint.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,8 @@ on:
1010
- translations
1111

1212
jobs:
13-
see_if_should_skip:
14-
runs-on: ubuntu-latest
15-
16-
outputs:
17-
should_skip: ${{ steps.skip_check.outputs.should_skip }}
18-
steps:
19-
- id: skip_check
20-
uses: fkirc/skip-duplicate-actions@36feb0d8d062137530c2e00bd278d138fe191289
21-
with:
22-
cancel_others: 'false'
23-
github_token: ${{ github.token }}
24-
paths: '["**/*.js", "package*.json", ".github/workflows/js-lint.yml", ".eslint*"]'
25-
2613
lint:
2714
runs-on: ubuntu-latest
28-
needs: see_if_should_skip
29-
if: ${{ needs.see_if_should_skip.outputs.should_skip != 'true' }}
3015
steps:
3116
- name: Check out repo
3217
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: OpenAPI generate decorated schema files
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [opened]
7+
8+
jobs:
9+
generate-decorated-files:
10+
if: github.event.pull_request.user.login == 'github-openapi-bot'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Label pull requests with 'github-openapi-bot'
14+
uses: rachmari/labeler@832d42ec5523f3c6d46e8168de71cd54363e3e2e
15+
with:
16+
repo-token: '${{ secrets.GITHUB_TOKEN }}'
17+
add-labels: 'github-openapi-bot'
18+
- name: Checkout repository code
19+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Decorate the dereferenced OpenAPI schemas
25+
run: script/rest/update-files.js --decorate-only
26+
27+
- name: Check in the decorated files
28+
uses: EndBug/add-and-commit@9358097a71ad9fb9e2f9624c6098c89193d83575
29+
with:
30+
# The arguments for the `git add` command
31+
add: 'lib/rest/static/decorated'
32+
33+
# The message for the commit
34+
message: 'Add decorated OpenAPI schema files'
35+
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: OpenAPI dev mode check
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
7+
jobs:
8+
check-schema-versions:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository code
12+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
13+
14+
- name: Install dependencies
15+
run: npm ci
16+
17+
# Differences between decorated and dereferenced files indicates a problem
18+
- name: Generate decorated files to check that there are no differences
19+
run: script/rest/update-files.js --decorate-only
20+
21+
- name: Check if deref/decorated schemas are dev mode and that they match
22+
run: .github/actions-scripts/openapi-schema-branch.js

0 commit comments

Comments
 (0)