From 8faf35a4925cb110705a91cb6d2b4bde93050cee Mon Sep 17 00:00:00 2001 From: Denis Smetannikov Date: Thu, 21 Mar 2024 01:09:52 +0400 Subject: [PATCH] GitHub actions. New default value: table (#68) The README.md file has been updated to reflect that the default report format for GitHub Actions is now 'table' instead of 'github'. This change has been applied consistently across the documentation, ensuring clearer understanding and more consistency for the users. --- README.md | 10 +++++----- action.yml | 4 ++-- src/Commands/ValidateCsv.php | 2 +- src/Validators/ErrorSuite.php | 1 + tests/GithubActionsTest.php | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c0f1bcd4..cc6a103a 100644 --- a/README.md +++ b/README.md @@ -387,10 +387,10 @@ You can find launch examples in the [workflow demo](https://github.com/JBZoo/Csv # Required: true schema: ./tests/schema.yml - # Report format. Available options: text, table, github, gitlab, teamcity, junit - # Default value: github + # Report format. Available options: text, table, github, gitlab, teamcity, junit. + # Default value: table # You can skip it - report: github + report: table # Quick mode. It will not validate all rows. It will stop after the first error. # Default value: no @@ -405,7 +405,7 @@ You can find launch examples in the [workflow demo](https://github.com/JBZoo/Csv ``` -**Note**. GitHub Actions report format is `github` by default. See [GitHub Actions friendly](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message) and [PR as a live demo](https://github.com/JBZoo/Csv-Blueprint-Demo/pull/1/files). +**Note**. GitHub Actions report format is `table` by default. See [GitHub Actions friendly](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message) and [PR as a live demo](https://github.com/JBZoo/Csv-Blueprint-Demo/pull/1/files). This allows you to see bugs in the GitHub interface at the PR level. That is, the error will be shown in a specific place in the CSV file right in diff of your Pull Requests! [See example](https://github.com/JBZoo/Csv-Blueprint-Demo/pull/1/files). @@ -586,7 +586,7 @@ Optional format `text` with highlited keywords: **Notes** -* Report format for GitHub Actions is `github` by default. +* Report format for GitHub Actions is `table` by default. * Tools uses [JBZoo/CI-Report-Converter](https://github.com/JBZoo/CI-Report-Converter) as SDK to convert reports to different formats. So you can easily integrate it with any CI system. diff --git a/action.yml b/action.yml index 4a5d6f7a..e5bea1c1 100644 --- a/action.yml +++ b/action.yml @@ -29,8 +29,8 @@ inputs: description: 'Schema filepath. It can be a YAML, JSON or PHP. See examples on GitHub.' required: true report: - description: 'Report format. Available options: text, table, github, gitlab, teamcity, junit' - default: github + description: 'Report format. Available options: text, table, github, gitlab, teamcity, junit.' + default: table required: true quick: description: 'Quick mode. It will not validate all rows. It will stop after the first error.' diff --git a/src/Commands/ValidateCsv.php b/src/Commands/ValidateCsv.php index 89b298da..84eb9bba 100644 --- a/src/Commands/ValidateCsv.php +++ b/src/Commands/ValidateCsv.php @@ -68,7 +68,7 @@ protected function configure(): void InputOption::VALUE_REQUIRED, "Report output format. Available options:\n" . '' . \implode(', ', ErrorSuite::getAvaiableRenderFormats()) . '', - ErrorSuite::RENDER_TABLE, + ErrorSuite::REPORT_DEFAULT, ) ->addOption( 'quick', diff --git a/src/Validators/ErrorSuite.php b/src/Validators/ErrorSuite.php index 16da07b3..49ec3802 100644 --- a/src/Validators/ErrorSuite.php +++ b/src/Validators/ErrorSuite.php @@ -34,6 +34,7 @@ final class ErrorSuite public const REPORT_GITLAB = 'gitlab'; public const REPORT_GITHUB = 'github'; public const REPORT_JUNIT = 'junit'; + public const REPORT_DEFAULT = self::RENDER_TABLE; /** @var Error[] */ private array $errors = []; diff --git a/tests/GithubActionsTest.php b/tests/GithubActionsTest.php index b5d9f7b8..a070b07c 100644 --- a/tests/GithubActionsTest.php +++ b/tests/GithubActionsTest.php @@ -42,7 +42,7 @@ public function testCreateCsvHelp(): void isSame( $action->findString('inputs.report.description'), - 'Report format. Available options: ' . \implode(', ', ErrorSuite::getAvaiableRenderFormats()), + 'Report format. Available options: ' . \implode(', ', ErrorSuite::getAvaiableRenderFormats()) . '.', ); } @@ -52,7 +52,7 @@ public function testGitHubActionsReadMe(): void $examples = [ 'csv' => './tests/**/*.csv', 'schema' => './tests/schema.yml', - 'report' => 'github', + 'report' => ErrorSuite::REPORT_DEFAULT, 'quick' => 'no', 'skip-schema' => 'no', ];