decorate script fix (#18201)
This commit is contained in:
2
.github/allowed-actions.js
vendored
2
.github/allowed-actions.js
vendored
@@ -39,6 +39,6 @@ module.exports = [
|
|||||||
"repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d",
|
"repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d",
|
||||||
"someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd",
|
"someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd",
|
||||||
"tjenkinson/gh-action-auto-merge-dependency-updates@4d7756c04d9d999c5968697a621b81c47f533d61",
|
"tjenkinson/gh-action-auto-merge-dependency-updates@4d7756c04d9d999c5968697a621b81c47f533d61",
|
||||||
"EndBug/add-and-commit@9358097a71ad9fb9e2f9624c6098c89193d83575",
|
"EndBug/add-and-commit@b3c7c1e078a023d75fb0bd326e02962575ce0519",
|
||||||
"dorny/paths-filter@eb75a1edc117d3756a18ef89958ee59f9500ba58",
|
"dorny/paths-filter@eb75a1edc117d3756a18ef89958ee59f9500ba58",
|
||||||
];
|
];
|
||||||
|
|||||||
5
.github/workflows/openapi-decorate.yml
vendored
5
.github/workflows/openapi-decorate.yml
vendored
@@ -25,13 +25,10 @@ jobs:
|
|||||||
run: script/rest/update-files.js --decorate-only
|
run: script/rest/update-files.js --decorate-only
|
||||||
|
|
||||||
- name: Check in the decorated files
|
- name: Check in the decorated files
|
||||||
uses: EndBug/add-and-commit@9358097a71ad9fb9e2f9624c6098c89193d83575
|
uses: EndBug/add-and-commit@b3c7c1e078a023d75fb0bd326e02962575ce0519
|
||||||
with:
|
with:
|
||||||
# The arguments for the `git add` command
|
# The arguments for the `git add` command
|
||||||
add: 'lib/rest/static/decorated'
|
add: 'lib/rest/static/decorated'
|
||||||
|
|
||||||
# The message for the commit
|
# The message for the commit
|
||||||
message: 'Add decorated OpenAPI schema files'
|
message: 'Add decorated OpenAPI schema files'
|
||||||
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
|
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ async function decorate () {
|
|||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
for (const [schemaName, schema] of Object.entries(dereferencedSchemas)) {
|
for (const [schemaName, schema] of Object.entries(dereferencedSchemas)) {
|
||||||
|
try {
|
||||||
// munge OpenAPI definitions object in an array of operations objects
|
// munge OpenAPI definitions object in an array of operations objects
|
||||||
const operations = await getOperations(schema)
|
const operations = await getOperations(schema)
|
||||||
|
|
||||||
@@ -103,5 +104,10 @@ async function decorate () {
|
|||||||
fs.writeFileSync(filename, JSON.stringify(operations, null, 2))
|
fs.writeFileSync(filename, JSON.stringify(operations, null, 2))
|
||||||
|
|
||||||
console.log('Wrote', path.relative(process.cwd(), filename))
|
console.log('Wrote', path.relative(process.cwd(), filename))
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
console.log('🐛 Whoops! It looks like the decorator script wasn\'t able to parse the dereferenced schema. A recent change may not yet be supported by the decorator. Please reach out in the #docs-engineering slack channel for help.')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user