Skip to content

Commit 9e5d72e

Browse files
committed
Merge branch 'main' into build-changelog
2 parents fc54b4d + 4484068 commit 9e5d72e

827 files changed

Lines changed: 2349825 additions & 5691 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.
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: 4 additions & 1 deletion
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-project-card@80140aaeb9730972a83c626031250621fe8f6670',
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',
3133
'rtCamp/action-slack-notify@e17352feaf9aee300bf0ebc1dfbf467d80438815',
32-
'tjenkinson/gh-action-auto-merge-dependency-updates@cee2ac0'
34+
'tjenkinson/gh-action-auto-merge-dependency-updates@cee2ac0',
35+
'EndBug/add-and-commit@9358097a71ad9fb9e2f9624c6098c89193d83575'
3336
]

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,34 @@ 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
22+
echo -e '\ncc @github/docs-content'>> broken_links.md
2123
- if: ${{ failure() }}
2224
name: Get title for issue
2325
id: check
2426
run: echo "::set-output name=title::$(head -1 broken_links.md)"
27+
- if: ${{ failure() }}
28+
name: Close previous report
29+
uses: lee-dohm/close-matching-issues@22002609b2555fe18f52b8e2e7c07cbf5529e8a8
30+
with:
31+
query: 'label:"broken+link+report"'
32+
token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
2533
- if: ${{ failure() }}
2634
name: Create issue from file
35+
id: broken-link-report
2736
uses: peter-evans/create-issue-from-file@a04ce672e3acedb1f8e416b46716ddfd09905326
2837
with:
2938
token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
3039
title: ${{ steps.check.outputs.title }}
3140
content-filepath: ./broken_links.md
3241
labels: broken link report
42+
- if: ${{ failure() }}
43+
name: Add issue to FR project board
44+
uses: peter-evans/create-or-update-project-card@80140aaeb9730972a83c626031250621fe8f6670
45+
with:
46+
project-repository: 'github'
47+
project-number: '1367'
48+
column-name: 'Docs-content FR issues'
49+
issue-number: ${{ steps.broken-link-report.outputs.issue-number }}
50+
token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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: Checkout repository code
14+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
15+
16+
- name: Install dependencies
17+
run: npm ci
18+
19+
- name: Decorate the dereferenced OpenAPI schemas
20+
run: script/rest/update-files.js --decorate-only
21+
22+
- name: Check in the decorated files
23+
uses: EndBug/add-and-commit@9358097a71ad9fb9e2f9624c6098c89193d83575
24+
with:
25+
# The arguments for the `git add` command
26+
add: 'lib/rest/static/decorated'
27+
28+
# The message for the commit
29+
message: 'Add decorated OpenAPI schema files'
30+
31+
env:
32+
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

.github/workflows/sync-single-english-algolia-index.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Algolia Sync Single English Index
33
on:
44
pull_request:
55
types:
6+
- labeled
7+
- unlabeled
68
- opened
79
- reopened
810
- synchronize
@@ -13,7 +15,7 @@ on:
1315
jobs:
1416
updateIndices:
1517
name: Update English index for single version based on a label's version
16-
if: github.repository == 'github/docs-internal' && startsWith(github.event.label.name, 'sync-english-index-for-')
18+
if: github.repository == 'github/docs-internal'
1719
runs-on: ubuntu-latest
1820
steps:
1921
- name: checkout
@@ -30,13 +32,13 @@ jobs:
3032
${{ runner.os }}-node-
3133
- name: npm ci
3234
run: npm ci
33-
- name: Get version from label
35+
- name: Get version from Algolia label if present; only continue if the label is found.
3436
id: getVersion
35-
run: |
36-
echo "::set-output name=version::$(github.event.label.name.split('sync-english-index-for-')[1])"
37-
- name: Sync English index for single version
37+
run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js
38+
- if: ${{ steps.getVersion.outputs.versionToSync }}
39+
name: Sync English index for single version
3840
env:
39-
VERSION: ${{ steps.getVersion.outputs.version }}
41+
VERSION: ${{ steps.getVersion.outputs.versionToSync }}
4042
LANGUAGE: 'en'
4143
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
4244
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}

content/actions/guides/building-and-testing-java-with-gradle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ steps:
9191

9292
### Caching dependencies
9393

94-
You can cache your dependencies to speed up your workflow runs. After a successful run, your local Gradle package cache will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote package repositories. For more information, see "[Caching dependencies to speed up workflows](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)" and the [`cache` action](https://github.com/marketplace/actions/cache).
94+
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache your dependencies to speed up your workflow runs. After a successful run, your local Gradle package cache will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote package repositories. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>" and the [`cache` action](https://github.com/marketplace/actions/cache).
9595

9696
{% raw %}
9797
```yaml

content/actions/guides/building-and-testing-java-with-maven.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ steps:
9191

9292
### Caching dependencies
9393

94-
You can cache your dependencies to speed up your workflow runs. After a successful run, your local Maven repository will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote Maven repositories. For more information, see "[Caching dependencies to speed up workflows](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)" and the [`cache` action](https://github.com/marketplace/actions/cache).
94+
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache your dependencies to speed up your workflow runs. After a successful run, your local Maven repository will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote Maven repositories. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>" and the [`cache` action](https://github.com/marketplace/actions/cache).
9595

9696
{% raw %}
9797
```yaml

content/actions/guides/building-and-testing-nodejs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ If you don't specify a Node.js version, {% data variables.product.prodname_dotco
129129
130130
{% data variables.product.prodname_dotcom %}-hosted runners have npm and Yarn dependency managers installed. You can use npm and Yarn to install dependencies in your workflow before building and testing your code. The Windows and Linux {% data variables.product.prodname_dotcom %}-hosted runners also have Grunt, Gulp, and Bower installed.
131131
132-
You can also cache dependencies to speed up your workflow. For more information, see "[Caching dependencies to speed up your workflow](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)."
132+
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
133133
134134
#### Example using npm
135135
@@ -227,7 +227,7 @@ always-auth=true
227227

228228
#### Example caching dependencies
229229

230-
You can cache dependencies using a unique key, and restore the dependencies when you run future workflows using the `cache` action. For more information, see "[Caching dependencies to speed up workflows](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)" and the [`cache` action](https://github.com/marketplace/actions/cache).
230+
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache dependencies using a unique key, and restore the dependencies when you run future workflows using the `cache` action. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>" and the [`cache` action](https://github.com/marketplace/actions/cache).
231231

232232
{% raw %}
233233
```yaml
@@ -241,7 +241,7 @@ steps:
241241
uses: actions/cache@v2
242242
with:
243243
# npm cache files are stored in `~/.npm` on Linux/macOS
244-
path: ~/.npm
244+
path: ~/.npm
245245
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
246246
restore-keys: |
247247
${{ runner.OS }}-node-

0 commit comments

Comments
 (0)