Skip to content

Commit 6fbdd1d

Browse files
authored
Merge branch 'main' into al-cheb/windows-default-shell
2 parents 66558af + 1756da8 commit 6fbdd1d

2,592 files changed

Lines changed: 2368537 additions & 140646 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-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',
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: 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: 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
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Algolia Sync Single English Index
2+
3+
on:
4+
pull_request:
5+
types:
6+
- labeled
7+
- unlabeled
8+
- opened
9+
- reopened
10+
- synchronize
11+
- ready_for_review
12+
- unlocked
13+
14+
# This workflow requires a label in the format `sync-english-index-for-<PLAN@RELEASE>`
15+
jobs:
16+
updateIndices:
17+
name: Update English index for single version based on a label's version
18+
if: github.repository == 'github/docs-internal'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: checkout
22+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
23+
- uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d
24+
with:
25+
node-version: 14.x
26+
- name: cache node modules
27+
uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a
28+
with:
29+
path: ~/.npm
30+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
31+
restore-keys: |
32+
${{ runner.os }}-node-
33+
- name: npm ci
34+
run: npm ci
35+
- name: Get version from Algolia label if present; only continue if the label is found.
36+
id: getVersion
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
40+
env:
41+
VERSION: ${{ steps.getVersion.outputs.versionToSync }}
42+
LANGUAGE: 'en'
43+
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
44+
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: npm run sync-search

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Examples of unacceptable behavior include:
2222
* Trolling, insulting or derogatory comments, and personal or political attacks
2323
* Public or private harassment
2424
* Publishing others' private information, such as a physical or email address, without their explicit permission
25+
* Contacting individual members, contributors, or leaders privately, outside designated community mechanisms, without their explicit permission
2526
* Other conduct which could reasonably be considered inappropriate in a professional setting
2627

2728
## Enforcement Responsibilities

content/actions/creating-actions/about-actions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ You can build Docker container and JavaScript actions. Actions require a metadat
3232
| Type | Operating system |
3333
| ---- | ------------------- |
3434
| Docker container | Linux |
35-
| JavaScript | Linux, MacOS, Windows |
36-
| Composite run steps | Linux, MacOS, Windows |
35+
| JavaScript | Linux, macOS, Windows |
36+
| Composite run steps | Linux, macOS, Windows |
3737

3838
#### Docker container actions
3939

0 commit comments

Comments
 (0)