Skip to content

Commit 6d193cb

Browse files
authored
Merge branch 'main' into patch-1
2 parents 03d825b + 02f0bad commit 6d193cb

File tree

453 files changed

+324601
-47209
lines changed

Some content is hidden

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

453 files changed

+324601
-47209
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ package.json @github/docs-engineering
2727
# Content strategy
2828
/contributing/content-markup-reference.md @github/docs-content-strategy
2929
/contributing/content-style-guide.md @github/docs-content-strategy
30+
/contributing/content-model.md @github/docs-content-strategy
31+
/contributing/content-style-guide.md @github/docs-content-strategy
32+
/contributing/content-templates.md @github/docs-content-strategy
3033

3134
# Make sure that Octokit maintainers get notified about changes
3235
# relevant to the Octokit libraries (https://github.com/octokit)

.github/PULL_REQUEST_TEMPLATE.md

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

2525
### Check off the following:
2626

27-
- [ ] I have reviewed my changes in staging (look for the **deploy-to-heroku** link in your pull request, then click **View deployment**).
27+
- [ ] I have reviewed my changes in staging (look for the latest deployment event in your pull request's timeline, then click **View deployment**).
2828
- [ ] For content changes, I have completed the [self-review checklist](https://github.com/github/docs/blob/main/CONTRIBUTING.md#self-review).
2929

3030
### Writer impact (This section is for GitHub staff members only):

.github/allowed-actions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module.exports = [
1010
"actions/labeler@5f867a63be70efff62b767459b009290364495eb", // v2.2.0
1111
"actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e", // v2.1.4
1212
"actions/setup-python@dc73133d4da04e56a135ae2246682783cc7c7cb6", // v2.2.2
13-
"ruby/setup-ruby@fdcfbcf14ec9672f6f615cb9589a1bc5dd69d262", // v1.64.1
1413
"actions/stale@9d6f46564a515a9ea11e7762ab3957ee58ca50da", // v3.0.16
1514
"alex-page/github-project-automation-plus@fdb7991b72040d611e1123d2b75ff10eda9372c9",
1615
"andymckay/labeler@22d5392de2b725cea4b284df5824125054049d84",
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
name: Staging - Deploy PR
2+
3+
# **What it does**: To deploy PRs to a Heroku staging environment.
4+
# **Why we have it**: To deploy with high visibility in case of failures.
5+
# **Who does it impact**: All contributors.
6+
7+
on:
8+
pull_request:
9+
types:
10+
- opened
11+
- reopened
12+
- synchronize
13+
- unlocked
14+
workflow_dispatch:
15+
inputs:
16+
pullRequestUrl:
17+
description: 'Pull Request URL'
18+
required: true
19+
default: 'https://github.com/github/docs/pull/1234'
20+
forceRebuild:
21+
description: 'Force the Heroku App to be rebuilt from scratch? (true/false)'
22+
required: false
23+
default: 'false'
24+
25+
jobs:
26+
validate-inputs:
27+
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
28+
name: Validate inputs
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 2
31+
outputs:
32+
headRef: ${{ steps.validate.outputs.headRef }}
33+
steps:
34+
- if: ${{ github.event_name == 'workflow_dispatch' }}
35+
name: Check out repo
36+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
37+
with:
38+
# Enables cloning the Early Access repo later with the relevant PAT
39+
persist-credentials: 'false'
40+
41+
- if: ${{ github.event_name == 'workflow_dispatch' }}
42+
name: Setup node
43+
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
44+
with:
45+
node-version: 16.x
46+
47+
- if: ${{ github.event_name == 'workflow_dispatch' }}
48+
name: Get npm cache directory
49+
id: npm-cache
50+
run: |
51+
echo "::set-output name=dir::$(npm config get cache)"
52+
53+
- if: ${{ github.event_name == 'workflow_dispatch' }}
54+
name: Cache node modules
55+
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
56+
with:
57+
path: ${{ steps.npm-cache.outputs.dir }}
58+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
59+
restore-keys: |
60+
${{ runner.os }}-node-
61+
62+
- if: ${{ github.event_name == 'workflow_dispatch' }}
63+
name: Install dependencies
64+
run: npm ci
65+
66+
- if: ${{ github.event_name == 'workflow_dispatch' }}
67+
name: Validate and get head.ref
68+
id: validate
69+
uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
70+
env:
71+
PR_URL: ${{ github.event.inputs.pullRequestUrl }}
72+
FORCE_REBUILD: ${{ github.event.inputs.forceRebuild }}
73+
with:
74+
script: |
75+
const parsePrUrl = require('./script/deployment/parse-pr-url')
76+
77+
// Manually resolve workflow_dispatch inputs
78+
const { PR_URL, FORCE_REBUILD } = process.env
79+
80+
if (!['true', 'false'].includes(FORCE_REBUILD)) {
81+
throw new Error(`'forceRebuild' input must be either 'true' or 'false' but was '${FORCE_REBUILD}'`)
82+
}
83+
84+
const { owner, repo, pullNumber } = parsePrUrl(PR_URL)
85+
if (!owner || !repo || !pullNumber) {
86+
throw new Error(`'pullRequestUrl' input must match URL format 'https://github.com/github/(docs|docs-internal)/pull/123' but was '${PR_URL}'`)
87+
}
88+
89+
const { data: pullRequest } = await github.pulls.get({
90+
owner,
91+
repo,
92+
pull_number: pullNumber
93+
})
94+
95+
core.setOutput('headRef', pullRequest.head.ref)
96+
97+
deploy:
98+
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
99+
needs: validate-inputs
100+
name: Deploy
101+
runs-on: ubuntu-latest
102+
timeout-minutes: 10
103+
concurrency:
104+
group: staging_${{ needs.validate-inputs.outputs.headRef || github.head_ref }}
105+
cancel-in-progress: true
106+
steps:
107+
- name: Check out repo
108+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
109+
with:
110+
# Enables cloning the Early Access repo later with the relevant PAT
111+
persist-credentials: 'false'
112+
113+
- name: Setup node
114+
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
115+
with:
116+
node-version: 16.x
117+
118+
- name: Get npm cache directory
119+
id: npm-cache
120+
run: |
121+
echo "::set-output name=dir::$(npm config get cache)"
122+
123+
- name: Cache node modules
124+
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
125+
with:
126+
path: ${{ steps.npm-cache.outputs.dir }}
127+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
128+
restore-keys: |
129+
${{ runner.os }}-node-
130+
131+
- name: Install dependencies
132+
run: npm ci
133+
134+
- name: Deploy
135+
uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138+
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
139+
DOCUBOT_REPO_PAT: ${{ secrets.DOCUBOT_REPO_PAT }}
140+
HYDRO_ENDPOINT: ${{ secrets.HYDRO_ENDPOINT }}
141+
HYDRO_SECRET: ${{ secrets.HYDRO_SECRET }}
142+
PR_URL: ${{ github.event.inputs.pullRequestUrl }}
143+
FORCE_REBUILD: ${{ github.event.inputs.forceRebuild }}
144+
with:
145+
script: |
146+
const { GITHUB_TOKEN, HEROKU_API_TOKEN } = process.env
147+
148+
// Exit if GitHub Actions PAT is not found
149+
if (!GITHUB_TOKEN) {
150+
throw new Error('You must supply a GITHUB_TOKEN environment variable!')
151+
}
152+
153+
// Exit if Heroku API token is not found
154+
if (!HEROKU_API_TOKEN) {
155+
throw new Error('You must supply a HEROKU_API_TOKEN environment variable!')
156+
}
157+
158+
const parsePrUrl = require('./script/deployment/parse-pr-url')
159+
const getOctokit = require('./script/helpers/github')
160+
const deployToStaging = require('./script/deployment/deploy-to-staging')
161+
162+
// This helper uses the `GITHUB_TOKEN` implicitly!
163+
// We're using our usual version of Octokit vs. the provided `github`
164+
// instance to avoid versioning discrepancies.
165+
const octokit = getOctokit()
166+
167+
try {
168+
let pullRequest = null
169+
let forceRebuild = false
170+
171+
// Manually resolve workflow_dispatch inputs
172+
if (context.eventName === 'workflow_dispatch') {
173+
const { PR_URL, FORCE_REBUILD } = process.env
174+
175+
forceRebuild = FORCE_REBUILD === 'true'
176+
177+
const { owner, repo, pullNumber } = parsePrUrl(PR_URL)
178+
if (!owner || !repo || !pullNumber) {
179+
throw new Error(`'pullRequestUrl' input must match URL format 'https://github.com/github/(docs|docs-internal)/pull/123' but was '${PR_URL}'`)
180+
}
181+
182+
const { data: pr } = await octokit.pulls.get({
183+
owner,
184+
repo,
185+
pull_number: pullNumber
186+
})
187+
pullRequest = pr
188+
}
189+
190+
await deployToStaging({
191+
herokuToken: HEROKU_API_TOKEN,
192+
octokit,
193+
pullRequest: pullRequest || context.payload.pull_request,
194+
forceRebuild,
195+
runId: context.runId
196+
})
197+
} catch (error) {
198+
console.error(`Failed to deploy to staging: ${error.message}`)
199+
console.error(error)
200+
throw error
201+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Staging - Undeploy PR
2+
3+
# **What it does**: To undeploy PRs from a Heroku staging environment, i.e. destroy the Heroku App.
4+
# **Why we have it**: To save money spent on deployments for closed PRs.
5+
# **Who does it impact**: All contributors.
6+
7+
on:
8+
pull_request:
9+
types:
10+
- closed
11+
- locked
12+
13+
jobs:
14+
undeploy:
15+
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
16+
name: Undeploy
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 2
19+
concurrency:
20+
group: staging_${{ github.head_ref }}
21+
cancel-in-progress: true
22+
steps:
23+
- name: Check out repo
24+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
25+
with:
26+
# Enables cloning the Early Access repo later with the relevant PAT
27+
persist-credentials: 'false'
28+
29+
- name: Setup node
30+
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
31+
with:
32+
node-version: 16.x
33+
34+
- name: Get npm cache directory
35+
id: npm-cache
36+
run: |
37+
echo "::set-output name=dir::$(npm config get cache)"
38+
39+
- name: Cache node modules
40+
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
41+
with:
42+
path: ${{ steps.npm-cache.outputs.dir }}
43+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
44+
restore-keys: |
45+
${{ runner.os }}-node-
46+
47+
- name: Install dependencies
48+
run: npm ci
49+
50+
- name: Undeploy
51+
uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
55+
with:
56+
script: |
57+
const { GITHUB_TOKEN, HEROKU_API_TOKEN } = process.env
58+
59+
// Exit if GitHub Actions PAT is not found
60+
if (!GITHUB_TOKEN) {
61+
throw new Error('You must supply a GITHUB_TOKEN environment variable!')
62+
}
63+
64+
// Exit if Heroku API token is not found
65+
if (!HEROKU_API_TOKEN) {
66+
throw new Error('You must supply a HEROKU_API_TOKEN environment variable!')
67+
}
68+
69+
const getOctokit = require('./script/helpers/github')
70+
const undeployFromStaging = require('./script/deployment/undeploy-from-staging')
71+
72+
// This helper uses the `GITHUB_TOKEN` implicitly!
73+
// We're using our usual version of Octokit vs. the provided `github`
74+
// instance to avoid versioning discrepancies.
75+
const octokit = getOctokit()
76+
77+
try {
78+
await undeployFromStaging({
79+
herokuToken: HEROKU_API_TOKEN,
80+
octokit,
81+
pullRequest: context.payload.pull_request,
82+
runId: context.runId
83+
})
84+
} catch (error) {
85+
console.error(`Failed to undeploy from staging: ${error.message}`)
86+
console.error(error)
87+
throw error
88+
}

.github/workflows/triage-unallowed-contributions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
103103
const badFiles = badFilesArr.join('\n')
104104
105-
let reviewMessage = `👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:\n${badFiles}\n\nYou'll need to revert all of the files you changed in that list using [GitHub Desktop](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/reverting-a-commit) or \`git checkout origin/main <file name>\`. Once you get those files reverted, we can continue with the review process. :octocat:`
105+
let reviewMessage = `👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:\n${badFiles}\n\nYou'll need to revert all of the files you changed in that list using [GitHub Desktop](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/managing-commits/reverting-a-commit) or \`git checkout origin/main <file name>\`. Once you get those files reverted, we can continue with the review process. :octocat:`
106106
107107
await github.pulls.createReview({
108108
...context.repo,

.github/workflows/update-graphql-files.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ jobs:
2929
exit 1 # prevents further steps from running
3030
- name: Checkout
3131
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
32-
- name: Set up Ruby
33-
uses: ruby/setup-ruby@fdcfbcf14ec9672f6f615cb9589a1bc5dd69d262
34-
with:
35-
ruby-version: '2.4'
36-
- name: Install Ruby dependencies
37-
run: |
38-
gem install bundler
39-
bundle install
4032
- name: Install Node.js dependencies
4133
run: npm ci
4234
- name: Run updater scripts

.github/workflows/workflow-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
- name: Run linter
2727
uses: cschleiden/actions-linter@0ff16d6ac5103cca6c92e6cbc922b646baaea5be
2828
with:
29-
workflows: '[".github/workflows/*.yml"]'
29+
workflows: '[".github/workflows/*.yml", "!.github/workflows/staging-deploy-pr.yml", "!.github/workflows/staging-undeploy-pr.yml"]'

Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

Gemfile.lock

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)