From f6bff24b05f62f5153c6165816b973d234e2f1f5 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Fri, 12 May 2023 22:21:14 +0600 Subject: [PATCH 01/19] Create update_usage_docs.js --- scripts/update_usage_docs.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 scripts/update_usage_docs.js diff --git a/scripts/update_usage_docs.js b/scripts/update_usage_docs.js new file mode 100644 index 00000000000..5fff17a136a --- /dev/null +++ b/scripts/update_usage_docs.js @@ -0,0 +1,29 @@ +const fs = require('fs'); +const util = require('util'); +const { exec } = require('child_process'); +const execPromisified = util.promisify(exec); + +const README_PATH = './README.md'; +const USAGE_PATH = '../docs/usage.md'; + +fs.appendFileSync(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n'); + +execPromisified('oclif readme').then(() => { + const header = `--- +title: 'Usage' +weight: 40 +--- + +The AsyncAPI CLI makes it easier to work with AsyncAPI documents. +`; + + fs.writeFileSync(USAGE_PATH, header); + + const readmeContents = fs.readFileSync(README_PATH, 'utf8'); + + fs.appendFileSync(USAGE_PATH, `\n${readmeContents}`); + + fs.unlinkSync(README_PATH); +}).catch((err) => { + console.error(err); +}); From e697fc412dfa3a0265fa1447c68c9d808f5a142b Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Fri, 12 May 2023 22:39:08 +0600 Subject: [PATCH 02/19] Updateing to pass test --- scripts/update_usage_docs.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/scripts/update_usage_docs.js b/scripts/update_usage_docs.js index 5fff17a136a..d60bedadab7 100644 --- a/scripts/update_usage_docs.js +++ b/scripts/update_usage_docs.js @@ -1,6 +1,7 @@ -const fs = require('fs'); -const util = require('util'); -const { exec } = require('child_process'); +import fs from 'fs'; +import util from 'util'; +import { exec } from 'child_process'; + const execPromisified = util.promisify(exec); const README_PATH = './README.md'; @@ -8,8 +9,9 @@ const USAGE_PATH = '../docs/usage.md'; fs.appendFileSync(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n'); -execPromisified('oclif readme').then(() => { - const header = `--- +execPromisified('oclif readme') + .then(() => { + const header = `--- title: 'Usage' weight: 40 --- @@ -17,13 +19,14 @@ weight: 40 The AsyncAPI CLI makes it easier to work with AsyncAPI documents. `; - fs.writeFileSync(USAGE_PATH, header); + fs.writeFileSync(USAGE_PATH, header); - const readmeContents = fs.readFileSync(README_PATH, 'utf8'); + const readmeContents = fs.readFileSync(README_PATH, 'utf8'); - fs.appendFileSync(USAGE_PATH, `\n${readmeContents}`); + fs.appendFileSync(USAGE_PATH, `\n${readmeContents}`); - fs.unlinkSync(README_PATH); -}).catch((err) => { - console.error(err); -}); + fs.unlinkSync(README_PATH); + }) + .catch((err) => { + console.error(err); + }); From 4084bd381f143d61653d24a5378cbe302f58f763 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Mon, 15 May 2023 16:44:22 +0600 Subject: [PATCH 03/19] added comments --- scripts/update_usage_docs.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/update_usage_docs.js b/scripts/update_usage_docs.js index d60bedadab7..8fa81d6e831 100644 --- a/scripts/update_usage_docs.js +++ b/scripts/update_usage_docs.js @@ -4,13 +4,22 @@ import { exec } from 'child_process'; const execPromisified = util.promisify(exec); +// Define the paths to the README (which will be created inside the ./script folder) and usage files const README_PATH = './README.md'; const USAGE_PATH = '../docs/usage.md'; +// Append the usage and commands tags to the README file +// The readme must have any of the following tags inside of it for it to be replaced after running `oclif readme` command +// # Usage +// +// # Commands +// fs.appendFileSync(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n'); +// Generate the usage documentation using the `oclif readme` command execPromisified('oclif readme') .then(() => { + // Define the header for the usage file const header = `--- title: 'Usage' weight: 40 @@ -20,11 +29,10 @@ The AsyncAPI CLI makes it easier to work with AsyncAPI documents. `; fs.writeFileSync(USAGE_PATH, header); - const readmeContents = fs.readFileSync(README_PATH, 'utf8'); - fs.appendFileSync(USAGE_PATH, `\n${readmeContents}`); + // Remove the generated README file fs.unlinkSync(README_PATH); }) .catch((err) => { From 0253bb077650b7874d5c261747f6e2801b402614 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Mon, 15 May 2023 18:18:16 +0600 Subject: [PATCH 04/19] Updateing to run update_usage script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c620c5da994..d74273ea785 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "build": "rimraf lib && node scripts/fetch-asyncapi-example.js && tsc && echo \"Build Completed\"", "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION", "dev": "tsc --watch", - "generate:assets": "npm run generate:readme:toc", + "generate:assets": "npm run generate:readme:toc && npm run generate:commands", "generate:readme:toc": "markdown-toc -i README.md", "lint": "eslint --max-warnings 0 --config .eslintrc .", "lint:fix": "eslint --max-warnings 5 --config .eslintrc . --fix", From 29736fcb9153b16ddad0ac0700e716de7f02b802 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Tue, 16 May 2023 18:15:55 +0600 Subject: [PATCH 05/19] Updateing to pass test --- scripts/update_usage_docs.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/update_usage_docs.js b/scripts/update_usage_docs.js index 8fa81d6e831..11037c30f97 100644 --- a/scripts/update_usage_docs.js +++ b/scripts/update_usage_docs.js @@ -1,8 +1,5 @@ -import fs from 'fs'; -import util from 'util'; -import { exec } from 'child_process'; - -const execPromisified = util.promisify(exec); +import fs from 'fs/promises'; +import { exec } from 'child_process/promises'; // Define the paths to the README (which will be created inside the ./script folder) and usage files const README_PATH = './README.md'; @@ -14,10 +11,10 @@ const USAGE_PATH = '../docs/usage.md'; // // # Commands // -fs.appendFileSync(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n'); +fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n'); // Generate the usage documentation using the `oclif readme` command -execPromisified('oclif readme') +exec('oclif readme') .then(() => { // Define the header for the usage file const header = `--- @@ -28,12 +25,15 @@ weight: 40 The AsyncAPI CLI makes it easier to work with AsyncAPI documents. `; - fs.writeFileSync(USAGE_PATH, header); - const readmeContents = fs.readFileSync(README_PATH, 'utf8'); - fs.appendFileSync(USAGE_PATH, `\n${readmeContents}`); - + fs.writeFile(USAGE_PATH, header); + return fs.readFile(README_PATH, 'utf8'); + }) + .then((readmeContents) => { + return fs.appendFile(USAGE_PATH, `\n${readmeContents}`); + }) + .then(() => { // Remove the generated README file - fs.unlinkSync(README_PATH); + return fs.unlink(README_PATH); }) .catch((err) => { console.error(err); From 5547e3a54590d58d67476ce6436f254e8c4b63c2 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Wed, 17 May 2023 21:35:50 +0600 Subject: [PATCH 06/19] updating script --- package.json | 1 + scripts/update_usage_docs.js | 34 +++++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index d74273ea785..b95c67ad19c 100644 --- a/package.json +++ b/package.json @@ -156,6 +156,7 @@ "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION", "dev": "tsc --watch", "generate:assets": "npm run generate:readme:toc && npm run generate:commands", + "generate:commands": "node scripts/update_usage_docs.js", "generate:readme:toc": "markdown-toc -i README.md", "lint": "eslint --max-warnings 0 --config .eslintrc .", "lint:fix": "eslint --max-warnings 5 --config .eslintrc . --fix", diff --git a/scripts/update_usage_docs.js b/scripts/update_usage_docs.js index 11037c30f97..545a0b8b5ce 100644 --- a/scripts/update_usage_docs.js +++ b/scripts/update_usage_docs.js @@ -1,9 +1,11 @@ -import fs from 'fs/promises'; -import { exec } from 'child_process/promises'; +const fs = require('fs').promises; +const { exec } = require('child_process'); // Define the paths to the README (which will be created inside the ./script folder) and usage files -const README_PATH = './README.md'; -const USAGE_PATH = '../docs/usage.md'; +const README_PATH = './scripts/README.md'; +const USAGE_PATH = './docs/usage.md'; +// const README_PATH = './README.md'; +// const USAGE_PATH = '../docs/usage.md'; // Append the usage and commands tags to the README file // The readme must have any of the following tags inside of it for it to be replaced after running `oclif readme` command @@ -11,10 +13,19 @@ const USAGE_PATH = '../docs/usage.md'; // // # Commands // -fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n'); - -// Generate the usage documentation using the `oclif readme` command -exec('oclif readme') +fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n') + .then(() => { + // Generate the usage documentation using the `oclif readme` command + return new Promise((resolve, reject) => { + exec('oclif readme', (error, stdout, stderr) => { + if (error) { + reject(error); + } else { + resolve(); + } + }); + }); + }) .then(() => { // Define the header for the usage file const header = `--- @@ -25,10 +36,15 @@ weight: 40 The AsyncAPI CLI makes it easier to work with AsyncAPI documents. `; - fs.writeFile(USAGE_PATH, header); + // Write the header to the usage file + return fs.writeFile(USAGE_PATH, header); + }) + .then(() => { + // Read the contents of the README file return fs.readFile(README_PATH, 'utf8'); }) .then((readmeContents) => { + // Append the README contents to the usage file return fs.appendFile(USAGE_PATH, `\n${readmeContents}`); }) .then(() => { From 3a2abb2e42bbe5e57040ad0ddc7e31510a6baf2b Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Wed, 17 May 2023 23:38:03 +0600 Subject: [PATCH 07/19] updating script --- scripts/update_usage_docs.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/scripts/update_usage_docs.js b/scripts/update_usage_docs.js index 545a0b8b5ce..db52c7a148e 100644 --- a/scripts/update_usage_docs.js +++ b/scripts/update_usage_docs.js @@ -1,23 +1,18 @@ +// Import the necessary modules const fs = require('fs').promises; const { exec } = require('child_process'); -// Define the paths to the README (which will be created inside the ./script folder) and usage files -const README_PATH = './scripts/README.md'; -const USAGE_PATH = './docs/usage.md'; -// const README_PATH = './README.md'; -// const USAGE_PATH = '../docs/usage.md'; +// Define the paths to the README and usage files +const README_PATH = './scripts/README.md'; // File path for the generated README file +const USAGE_PATH = './docs/usage.md'; // File path for the usage documentation file -// Append the usage and commands tags to the README file -// The readme must have any of the following tags inside of it for it to be replaced after running `oclif readme` command -// # Usage -// -// # Commands -// +// Append usage and commands tags to the README file +// These tags are later replaced by the `oclif readme` command with actual usage documentation fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n') .then(() => { // Generate the usage documentation using the `oclif readme` command return new Promise((resolve, reject) => { - exec('oclif readme', (error, stdout, stderr) => { + exec('oclif readme', { cwd: './scripts' }, (error, stdout, stderr) => { if (error) { reject(error); } else { From 611069dc534965fbcc844934e500bae55c851a43 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Wed, 17 May 2023 23:42:46 +0600 Subject: [PATCH 08/19] updating to pass test --- scripts/update_usage_docs.js | 52 +++++++++++++++++------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/scripts/update_usage_docs.js b/scripts/update_usage_docs.js index db52c7a148e..eb9771c8974 100644 --- a/scripts/update_usage_docs.js +++ b/scripts/update_usage_docs.js @@ -1,17 +1,17 @@ -// Import the necessary modules -const fs = require('fs').promises; -const { exec } = require('child_process'); - -// Define the paths to the README and usage files -const README_PATH = './scripts/README.md'; // File path for the generated README file -const USAGE_PATH = './docs/usage.md'; // File path for the usage documentation file - -// Append usage and commands tags to the README file -// These tags are later replaced by the `oclif readme` command with actual usage documentation -fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n') - .then(() => { +import { promises as fs } from 'fs'; +import { exec } from 'child_process'; + +const README_PATH = './scripts/README.md'; +const USAGE_PATH = './docs/usage.md'; + +(async () => { + try { + // Append usage and commands tags to the README file + // These tags are later replaced by the `oclif readme` command with actual usage documentation + await fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n'); + // Generate the usage documentation using the `oclif readme` command - return new Promise((resolve, reject) => { + await new Promise((resolve, reject) => { exec('oclif readme', { cwd: './scripts' }, (error, stdout, stderr) => { if (error) { reject(error); @@ -20,8 +20,7 @@ fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n\n# Commands\n\n\n'); - +// Import the necessary modules +const fs = require('fs').promises; +const { exec } = require('child_process'); + +// Define the paths to the README and usage files +const README_PATH = './scripts/README.md'; // File path for the generated README file +const USAGE_PATH = './docs/usage.md'; // File path for the usage documentation file + +// Append usage and commands tags to the README file +// These tags are later replaced by the `oclif readme` command with actual usage documentation +fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n') + .then(() => { // Generate the usage documentation using the `oclif readme` command - await new Promise((resolve, reject) => { - exec('oclif readme', { cwd: './scripts' }, (error, _stdout, _stderr) => { + return new Promise((resolve, reject) => { + exec('oclif readme', { cwd: './scripts' }, (error, stdout, stderr) => { if (error) { reject(error); } else { @@ -20,7 +20,8 @@ const USAGE_PATH = './docs/usage.md'; } }); }); - + }) + .then(() => { // Define the header for the usage file const header = `--- title: 'Usage' @@ -31,17 +32,20 @@ The AsyncAPI CLI makes it easier to work with AsyncAPI documents. `; // Write the header to the usage file - await fs.writeFile(USAGE_PATH, header); - + return fs.writeFile(USAGE_PATH, header); + }) + .then(() => { // Read the contents of the README file - const readmeContents = await fs.readFile(README_PATH, 'utf8'); - + return fs.readFile(README_PATH, 'utf8'); + }) + .then((readmeContents) => { // Append the README contents to the usage file - await fs.appendFile(USAGE_PATH, `\n${readmeContents}`); - + return fs.appendFile(USAGE_PATH, `\n${readmeContents}`); + }) + .then(() => { // Remove the generated README file - await fs.unlink(README_PATH); - } catch (err) { + return fs.unlink(README_PATH); + }) + .catch((err) => { console.error(err); - } -})(); + }); From 38d623e2b15ccb4ccd75ae150b74f501f75ea633 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Thu, 18 May 2023 00:00:09 +0600 Subject: [PATCH 11/19] updating to pass test --- scripts/update_usage_docs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/update_usage_docs.js b/scripts/update_usage_docs.js index db52c7a148e..ccf9553583a 100644 --- a/scripts/update_usage_docs.js +++ b/scripts/update_usage_docs.js @@ -12,7 +12,7 @@ fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n\n# Commands\n\n\n' > scripts/README.md", + "generate:readme:commands": "cd scripts && oclif readme", "generate:assets": "npm run generate:readme:toc && npm run generate:commands", - "generate:commands": "node scripts/update_usage_docs.js", + "generate:commands": "npm run generate:readme:create && npm run generate:readme:commands && node ./scripts/updateUsageDocs.js && rimraf ./scripts/README.md", "generate:readme:toc": "markdown-toc -i README.md", "lint": "eslint --max-warnings 0 --config .eslintrc .", "lint:fix": "eslint --max-warnings 5 --config .eslintrc . --fix", diff --git a/scripts/updateUsageDocs.js b/scripts/updateUsageDocs.js new file mode 100644 index 00000000000..77115144ea5 --- /dev/null +++ b/scripts/updateUsageDocs.js @@ -0,0 +1,26 @@ +const { writeFile, readFile } = require('fs').promises; + +// Define the paths to the README and usage files +const README_PATH = './scripts/README.md'; // File path for the generated README file +const USAGE_PATH = './docs/usage.md'; + +// Create a header for the usage.md file +const header = ` +--- +title: 'Usage' +weight: 40 +--- + +The AsyncAPI CLI makes it easier to work with AsyncAPI documents. +`; + +// Define an async function to write the header and the README contents to the usage documentation file +async function run() { + await writeFile(USAGE_PATH, header, { encoding: 'utf8' }); + const readmeContents = await readFile(README_PATH, 'utf8'); + + // Append the contents of the README file to the usage documentation file + await writeFile(USAGE_PATH, readmeContents, { encoding: 'utf8', flag: 'a' }); +} + +run(); \ No newline at end of file diff --git a/scripts/update_usage_docs.js b/scripts/update_usage_docs.js deleted file mode 100644 index cc11dd3e3ea..00000000000 --- a/scripts/update_usage_docs.js +++ /dev/null @@ -1,50 +0,0 @@ -const fs = require('fs').promises; -const { exec } = require('child_process'); - -// Define the paths to the README and usage files -const README_PATH = './scripts/README.md'; // File path for the generated README file -const USAGE_PATH = './docs/usage.md'; // File path for the usage documentation file - -// Append usage and commands tags to the README file -// These tags are later replaced by the `oclif readme` command with actual usage documentation -fs.appendFile(README_PATH, '\n\n# Usage\n\n\n\n# Commands\n\n\n') - .then(() => { - // Generate the usage documentation using the `oclif readme` command - return new Promise((resolve, reject) => { - exec('oclif readme', { cwd: './scripts' }, (error) => { - if (error) { - reject(error); - } else { - resolve(); - } - }); - }); - }) - .then(() => { - // Define the header for the usage file - const header = `--- -title: 'Usage' -weight: 40 ---- - -The AsyncAPI CLI makes it easier to work with AsyncAPI documents. -`; - - // Write the header to the usage file - return fs.writeFile(USAGE_PATH, header); - }) - .then(() => { - // Read the contents of the README file - return fs.readFile(README_PATH, 'utf8'); - }) - .then((readmeContents) => { - // Append the README contents to the usage file - return fs.writeFile(USAGE_PATH, readmeContents, { flag: 'a' }); - }) - .then(() => { - // Remove the generated README file - return fs.unlink(README_PATH); - }) - .catch((err) => { - console.error(err); - }); From 6d4ebdac50b4adcdc32532f5b85f6d6d35e41302 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Thu, 18 May 2023 19:29:53 +0600 Subject: [PATCH 16/19] update --- scripts/updateUsageDocs.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/updateUsageDocs.js b/scripts/updateUsageDocs.js index 77115144ea5..01a2dc46100 100644 --- a/scripts/updateUsageDocs.js +++ b/scripts/updateUsageDocs.js @@ -1,12 +1,11 @@ -const { writeFile, readFile } = require('fs').promises; +/* eslint-disable @typescript-eslint/no-var-requires */ +const {writeFile, readFile} = require('fs').promises; // Define the paths to the README and usage files const README_PATH = './scripts/README.md'; // File path for the generated README file -const USAGE_PATH = './docs/usage.md'; +const USAGE_PATH = './docs/usage.md'; // File path for the usage documentation file -// Create a header for the usage.md file -const header = ` ---- +const header = `--- title: 'Usage' weight: 40 --- @@ -16,11 +15,14 @@ The AsyncAPI CLI makes it easier to work with AsyncAPI documents. // Define an async function to write the header and the README contents to the usage documentation file async function run() { - await writeFile(USAGE_PATH, header, { encoding: 'utf8' }); - const readmeContents = await readFile(README_PATH, 'utf8'); - - // Append the contents of the README file to the usage documentation file - await writeFile(USAGE_PATH, readmeContents, { encoding: 'utf8', flag: 'a' }); + try { + await writeFile(USAGE_PATH, header); + const readmeContents = await readFile(README_PATH, 'utf8'); + // Append the contents of the README file to the usage documentation file + await writeFile(USAGE_PATH, readmeContents, { flag: 'a' }); + } catch (e) { + console.error(e); + } } run(); \ No newline at end of file From 70e22b635e6ff15ee9427a36c1f67666c1cf482d Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Thu, 18 May 2023 20:38:33 +0600 Subject: [PATCH 17/19] trying to fix lint error --- scripts/updateUsageDocs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/updateUsageDocs.js b/scripts/updateUsageDocs.js index 01a2dc46100..8f4fd51a4ae 100644 --- a/scripts/updateUsageDocs.js +++ b/scripts/updateUsageDocs.js @@ -18,11 +18,11 @@ async function run() { try { await writeFile(USAGE_PATH, header); const readmeContents = await readFile(README_PATH, 'utf8'); - // Append the contents of the README file to the usage documentation file + // Append the contents of the README file to the usage documentation file await writeFile(USAGE_PATH, readmeContents, { flag: 'a' }); } catch (e) { console.error(e); } } -run(); \ No newline at end of file +run(); From 6bf0262a49d1811a501cb902bb880f6ceb0f5435 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Sun, 21 May 2023 09:26:06 +0600 Subject: [PATCH 18/19] updated comment --- scripts/updateUsageDocs.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/updateUsageDocs.js b/scripts/updateUsageDocs.js index 8f4fd51a4ae..27a90ba5f56 100644 --- a/scripts/updateUsageDocs.js +++ b/scripts/updateUsageDocs.js @@ -10,6 +10,21 @@ title: 'Usage' weight: 40 --- + + The AsyncAPI CLI makes it easier to work with AsyncAPI documents. `; From 1d4714d2a6984a096afd5462c6211ac35675eaad Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Thu, 25 May 2023 15:58:50 +0600 Subject: [PATCH 19/19] update usage documentation for new commands --- .../workflows/update-docs-on-docs-commits.yml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/update-docs-on-docs-commits.yml diff --git a/.github/workflows/update-docs-on-docs-commits.yml b/.github/workflows/update-docs-on-docs-commits.yml new file mode 100644 index 00000000000..9d4405e3234 --- /dev/null +++ b/.github/workflows/update-docs-on-docs-commits.yml @@ -0,0 +1,37 @@ +name: 'Update generated parts of documentation on docs: commits' + +on: + push: + branches: + - master + +jobs: + docs-gen: + name: 'Generate docs and create PR' + # PR should be created within this GH action only if it is a docs: commit + # Otherwise it will conflict with release workflow + if: startsWith(github.event.commits[0].message, 'docs:') + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies + run: npm ci + - name: Regenerate docs + run: npm run generate:assets --if-present + - name: Create Pull Request with updated docs + if: startsWith(github.event.commits[0].message, 'docs:') + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GH_TOKEN }} + commit-message: 'chore: update generated docs' + committer: asyncapi-bot + author: asyncapi-bot + title: 'chore: update generated docs' + body: 'Update of docs that are generated and were forgotten on PR level.' + branch: gen-docs-update + \ No newline at end of file