Skip to content

Commit 65c3a19

Browse files
authored
Merge branch 'main' into patch-1
2 parents 14c0991 + 64aca19 commit 65c3a19

File tree

2,526 files changed

+1740521
-139309
lines changed

Some content is hidden

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

2,526 files changed

+1740521
-139309
lines changed
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

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)