From 9c6826e13a2a68bb880e75847fb4a450a3ffae4d Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 10:52:21 -0800 Subject: [PATCH 01/14] chore: temporarily set failed validation output --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3af58c2c5..932103ae9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: - name: Run `validate` command uses: ./rdme-repo/ with: - rdme: validate oas-examples-repo/3.1/json/petstore.json + rdme: validate rdme-repo/__tests__/__fixtures__/invalid-oas-3.1.json # Docs: https://rdme-test.readme.io - name: Run `openapi` command From 398076549f22e67089e789ccc760532eeb77b7f5 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 10:56:24 -0800 Subject: [PATCH 02/14] chore: identify color support --- bin/rdme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/rdme b/bin/rdme index 274ca3db3..ab1f0f48a 100755 --- a/bin/rdme +++ b/bin/rdme @@ -24,6 +24,21 @@ require('../src')(process.argv.slice(2)) message = err.message; } + if (chalk.supportsColor.stdout) { + // eslint-disable-next-line no-console + console.log('Terminal stdout supports color'); + } + + if (chalk.supportsColor.stdout.has256) { + // eslint-disable-next-line no-console + console.log('Terminal stdout supports 256 colors'); + } + + if (chalk.supportsColor.stderr.has16m) { + // eslint-disable-next-line no-console + console.log('Terminal stderr supports 16 million colors (truecolor)'); + } + /** * If we're in a GitHub Actions environment, log errors with that formatting instead. * @link: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message From b4b221cc9a6618fe11ef3404124f83aced176d34 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 10:58:18 -0800 Subject: [PATCH 03/14] fix: try this --- bin/rdme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/rdme b/bin/rdme index ab1f0f48a..a690397d0 100755 --- a/bin/rdme +++ b/bin/rdme @@ -24,17 +24,17 @@ require('../src')(process.argv.slice(2)) message = err.message; } - if (chalk.supportsColor.stdout) { + if (chalk.supportsColor) { // eslint-disable-next-line no-console console.log('Terminal stdout supports color'); } - if (chalk.supportsColor.stdout.has256) { + if (chalk.supportsColor.has256) { // eslint-disable-next-line no-console console.log('Terminal stdout supports 256 colors'); } - if (chalk.supportsColor.stderr.has16m) { + if (chalk.supportsColor.has16m) { // eslint-disable-next-line no-console console.log('Terminal stderr supports 16 million colors (truecolor)'); } From b1b0cf408bc37aa5733e95b24d11f996294ccc72 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 10:58:28 -0800 Subject: [PATCH 04/14] fix: try not forcing color --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index c63975c8f..4e23d43be 100644 --- a/action.yml +++ b/action.yml @@ -24,5 +24,5 @@ runs: - name: Execute rdme command run: ${{ github.action_path }}/bin/rdme ${{ inputs.rdme }} shell: bash - env: - FORCE_COLOR: '1' + # env: + # FORCE_COLOR: '1' From 9c90b03a90a4a355c4a8438eb676b5771589c29d Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 11:47:51 -0800 Subject: [PATCH 05/14] chore: try this instead --- bin/rdme | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/bin/rdme b/bin/rdme index a690397d0..73621dde2 100755 --- a/bin/rdme +++ b/bin/rdme @@ -24,20 +24,8 @@ require('../src')(process.argv.slice(2)) message = err.message; } - if (chalk.supportsColor) { - // eslint-disable-next-line no-console - console.log('Terminal stdout supports color'); - } - - if (chalk.supportsColor.has256) { - // eslint-disable-next-line no-console - console.log('Terminal stdout supports 256 colors'); - } - - if (chalk.supportsColor.has16m) { - // eslint-disable-next-line no-console - console.log('Terminal stderr supports 16 million colors (truecolor)'); - } + // eslint-disable-next-line no-console + console.log('chalk.supportsColor:', chalk.supportsColor); /** * If we're in a GitHub Actions environment, log errors with that formatting instead. From b7e4a1e7ad7a6fcb815c2036e5f736d5d5614a03 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 11:51:05 -0800 Subject: [PATCH 06/14] chore: try level 2 --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 4e23d43be..c7f903983 100644 --- a/action.yml +++ b/action.yml @@ -24,5 +24,5 @@ runs: - name: Execute rdme command run: ${{ github.action_path }}/bin/rdme ${{ inputs.rdme }} shell: bash - # env: - # FORCE_COLOR: '1' + env: + FORCE_COLOR: '2' From d29b593efdf3ea13494a0d0037653d45a063510a Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 11:51:22 -0800 Subject: [PATCH 07/14] chore: try level 3 --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c7f903983..143bbc52e 100644 --- a/action.yml +++ b/action.yml @@ -25,4 +25,4 @@ runs: run: ${{ github.action_path }}/bin/rdme ${{ inputs.rdme }} shell: bash env: - FORCE_COLOR: '2' + FORCE_COLOR: '3' From 9a79aa82f1c5cf87617eddc3e8b435b97374ea26 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 11:52:37 -0800 Subject: [PATCH 08/14] chore: try level 1 --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 143bbc52e..c63975c8f 100644 --- a/action.yml +++ b/action.yml @@ -25,4 +25,4 @@ runs: run: ${{ github.action_path }}/bin/rdme ${{ inputs.rdme }} shell: bash env: - FORCE_COLOR: '3' + FORCE_COLOR: '1' From 3039bfc2f701543f97742303e26aa2ad1aa30848 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 11:53:03 -0800 Subject: [PATCH 09/14] chore: remove `FORCE_COLOR` var --- action.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/action.yml b/action.yml index c63975c8f..decd2d256 100644 --- a/action.yml +++ b/action.yml @@ -24,5 +24,3 @@ runs: - name: Execute rdme command run: ${{ github.action_path }}/bin/rdme ${{ inputs.rdme }} shell: bash - env: - FORCE_COLOR: '1' From 6e5eaebe505222d22021a3cdd2c31567cba2959b Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 11:53:18 -0800 Subject: [PATCH 10/14] chore: try level 0 --- action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/action.yml b/action.yml index decd2d256..5db058287 100644 --- a/action.yml +++ b/action.yml @@ -24,3 +24,5 @@ runs: - name: Execute rdme command run: ${{ github.action_path }}/bin/rdme ${{ inputs.rdme }} shell: bash + env: + FORCE_COLOR: '0' From 27d36b37487d246ebb78950e93334d82ff9f48b7 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 12:14:10 -0800 Subject: [PATCH 11/14] chore: try handrolling `::error::` formatting --- bin/rdme | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bin/rdme b/bin/rdme index 73621dde2..d177c95e6 100755 --- a/bin/rdme +++ b/bin/rdme @@ -1,6 +1,5 @@ #! /usr/bin/env node const chalk = require('chalk'); -const core = require('@actions/core'); const updateNotifier = require('update-notifier'); const pkg = require('../package.json'); @@ -24,19 +23,17 @@ require('../src')(process.argv.slice(2)) message = err.message; } - // eslint-disable-next-line no-console - console.log('chalk.supportsColor:', chalk.supportsColor); - /** * If we're in a GitHub Actions environment, log errors with that formatting instead. * @link: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message * @link: https://github.com/actions/toolkit/tree/main/packages/core#annotations */ if (isGHA()) { - return core.setFailed(message); + console.error(`::error::${chalk.red(`\n${message}\n`)}`); + } else { + // eslint-disable-next-line no-console + console.error(chalk.red(`\n${message}\n`)); } - // eslint-disable-next-line no-console - console.error(chalk.red(`\n${message}\n`)); return process.exit(1); }); From 88480b45e72033b7ae9e49f334406ed3690b8de2 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 12:16:07 -0800 Subject: [PATCH 12/14] chore: remove newlines, set FORCE_COLOR to 1 --- action.yml | 2 +- bin/rdme | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 5db058287..c63975c8f 100644 --- a/action.yml +++ b/action.yml @@ -25,4 +25,4 @@ runs: run: ${{ github.action_path }}/bin/rdme ${{ inputs.rdme }} shell: bash env: - FORCE_COLOR: '0' + FORCE_COLOR: '1' diff --git a/bin/rdme b/bin/rdme index d177c95e6..d5e1f0f21 100755 --- a/bin/rdme +++ b/bin/rdme @@ -29,7 +29,8 @@ require('../src')(process.argv.slice(2)) * @link: https://github.com/actions/toolkit/tree/main/packages/core#annotations */ if (isGHA()) { - console.error(`::error::${chalk.red(`\n${message}\n`)}`); + // eslint-disable-next-line no-console + console.error(`::error::${chalk.red(message)}`); } else { // eslint-disable-next-line no-console console.error(chalk.red(`\n${message}\n`)); From b70793f3a5abee57947b466cb0f5ab0dcb6b5470 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 12:57:18 -0800 Subject: [PATCH 13/14] revert: restore old bin/rdme, remove `FORCE_COLOR` --- action.yml | 2 -- bin/rdme | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index c63975c8f..decd2d256 100644 --- a/action.yml +++ b/action.yml @@ -24,5 +24,3 @@ runs: - name: Execute rdme command run: ${{ github.action_path }}/bin/rdme ${{ inputs.rdme }} shell: bash - env: - FORCE_COLOR: '1' diff --git a/bin/rdme b/bin/rdme index d5e1f0f21..e5c7551d6 100755 --- a/bin/rdme +++ b/bin/rdme @@ -1,5 +1,6 @@ #! /usr/bin/env node const chalk = require('chalk'); +const core = require('@actions/core'); const updateNotifier = require('update-notifier'); const pkg = require('../package.json'); @@ -29,12 +30,11 @@ require('../src')(process.argv.slice(2)) * @link: https://github.com/actions/toolkit/tree/main/packages/core#annotations */ if (isGHA()) { - // eslint-disable-next-line no-console - console.error(`::error::${chalk.red(message)}`); - } else { - // eslint-disable-next-line no-console - console.error(chalk.red(`\n${message}\n`)); + return core.setFailed(message); } + // eslint-disable-next-line no-console + console.error(chalk.red(`\n${message}\n`)); + return process.exit(1); }); From 3fcdf3ab9808680c5114b1840687432b4f4064e5 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Thu, 3 Mar 2022 13:11:14 -0800 Subject: [PATCH 14/14] revert: restore passing CI --- .github/workflows/ci.yml | 2 +- bin/rdme | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 932103ae9..3af58c2c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: - name: Run `validate` command uses: ./rdme-repo/ with: - rdme: validate rdme-repo/__tests__/__fixtures__/invalid-oas-3.1.json + rdme: validate oas-examples-repo/3.1/json/petstore.json # Docs: https://rdme-test.readme.io - name: Run `openapi` command diff --git a/bin/rdme b/bin/rdme index e5c7551d6..274ca3db3 100755 --- a/bin/rdme +++ b/bin/rdme @@ -35,6 +35,5 @@ require('../src')(process.argv.slice(2)) // eslint-disable-next-line no-console console.error(chalk.red(`\n${message}\n`)); - return process.exit(1); });