From a188d4e7b5e8ffed274a5f027e31cb0cec77a258 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Wed, 15 Nov 2023 08:44:34 -0700 Subject: [PATCH 1/2] fix: properly escape default values --- internal/types/code_block.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/types/code_block.go b/internal/types/code_block.go index 90816e2..7cd104b 100644 --- a/internal/types/code_block.go +++ b/internal/types/code_block.go @@ -165,7 +165,7 @@ func renderCodeBlockActionInputs(inputs map[string]ActionInput, repository, tag for _, key := range keys { codeBlock.WriteString(fmt.Sprintf(" # %s\n", utils.WordWrap(inputs[key].Description, 9, "\n # "))) if inputs[key].Default != "" { - codeBlock.WriteString(fmt.Sprintf(" # Default: %s\n", inputs[key].Default)) + codeBlock.WriteString(fmt.Sprintf(" # Default: %s\n", utils.FormatValue(inputs[key].Default))) } if inputs[key].DeprecationMessage != "" { codeBlock.WriteString(fmt.Sprintf(" # Deprecated: %s\n", inputs[key].DeprecationMessage)) From 2943c6668a2440d7db79e92f6540472cbe15a378 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 15 Nov 2023 15:45:19 +0000 Subject: [PATCH 2/2] Updated README. --- README.md | 18 ++++++------ test/README-codeBlocks.md | 40 +++++++++++++-------------- test/README-codeBlocksMajorVersion.md | 40 +++++++++++++-------------- 3 files changed, 47 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 1b7ac62..0645e1d 100644 --- a/README.md +++ b/README.md @@ -72,15 +72,15 @@ and/or `Description` (only supported by actions) bin_path: '' # Max width of a column - # Default: 1000 + # Default: `"1000"` col_max_width: '' # Max number of words per line in a column - # Default: 5 + # Default: `"5"` col_max_words: '' # Path to the yaml file - # Default: action.yml + # Default: `"action.yml"` filename: '' # List of action.yml **input** columns names to display, default @@ -89,11 +89,11 @@ and/or `Description` (only supported by actions) # Boolean indicating whether to output input, output and secret # names as markdown links - # Default: true + # Default: `"true"` markdown_links: '' # Path to the output file - # Default: README.md + # Default: `"README.md"` output: '' # List of action.yml **output** column names to display, default @@ -101,7 +101,7 @@ and/or `Description` (only supported by actions) output_columns: '' # Repository name with owner. For example, tj-actions/auto-doc - # Default: ${{ github.repository }} + # Default: `"${{ github.repository }}"` repository: '' # Boolean Indicating whether the file is a reusable workflow @@ -121,16 +121,16 @@ and/or `Description` (only supported by actions) # GitHub token or Personal Access Token used to fetch # the repository latest tag. - # Default: ${{ github.token }} + # Default: `"${{ github.token }}"` token: '' # Enable code block documentation - # Default: false + # Default: `"false"` use_code_blocks: '' # Use the major version of the repository tag e.g # v1.0.0 -> v1 - # Default: false + # Default: `"false"` use_major_version: '' # The version number to run diff --git a/test/README-codeBlocks.md b/test/README-codeBlocks.md index 127fdfb..a0d6548 100644 --- a/test/README-codeBlocks.md +++ b/test/README-codeBlocks.md @@ -17,7 +17,7 @@ # Output unique changed directories instead of filenames. **NOTE:** This # returns `.` for changed files located in the root # of the project. - # Default: false + # Default: `"false"` dir_names: '' # Maximum depth of directories to output. e.g `test/test1/test2` with @@ -26,7 +26,7 @@ # Depth of additional branch history fetched. **NOTE**: This can # be adjusted to resolve errors with insufficient history. - # Default: 50 + # Default: `"50"` fetch_depth: '' # File and directory patterns to detect changes using only @@ -45,70 +45,68 @@ files_ignore_from_source_file: '' # Separator used to split the `files_ignore` input - # Default: - + # Default: `"\n"` files_ignore_separator: '' # Separator used to split the `files` input - # Default: - + # Default: `"\n"` files_separator: '' # Include `all_old_new_renamed_files` output. Note this can generate a large # output See: [#501](https://github.com/tj-actions/changed-files/issues/501). - # Default: false + # Default: `"false"` include_all_old_new_renamed_files: '' # Output list of changed files in a JSON formatted # string which can be used for matrix jobs. - # Default: false + # Default: `"false"` json: '' # Output list of changed files in a raw format # which means that the output will not be surrounded # by quotes and special characters will not be escaped. - # Default: false + # Default: `"false"` # Deprecated: Use `json_unescaped` instead. json_raw_format: '' # Output list of changed files in a JSON formatted # string without escaping special characters. - # Default: false + # Default: `"false"` json_unescaped: '' # Boolean indicating whether to output input, output and secret # names as markdown links - # Default: false + # Default: `"false"` markdown_links: '' # Indicates whether to include match directories - # Default: true + # Default: `"true"` match_directories: '' # Split character for old and new renamed filename pairs. - # Default: + # Default: `" "` old_new_files_separator: '' # Split character for old and new filename pairs. - # Default: , + # Default: `","` old_new_separator: '' # Directory to store output files. - # Default: .github/outputs + # Default: `".github/outputs"` output_dir: '' # Specify a relative path under `$GITHUB_WORKSPACE` to locate the # repository. - # Default: . + # Default: `"."` path: '' # Use non ascii characters to match files and output # the filenames completely verbatim by setting this to `false` - # Default: true + # Default: `"true"` quotepath: '' # Split character for output strings. - # Default: + # Default: `" "` separator: '' # Specify a different commit SHA used for comparing changes @@ -123,11 +121,11 @@ # on the target branch for pull request events and # the previous remote commit of the current branch for # push events. - # Default: false + # Default: `"false"` since_last_remote_commit: '' # The GitHub token to use for authentication. - # Default: ${{ github.token }} + # Default: `"${{ github.token }}"` token: '' # Get changed files for commits whose timestamp is earlier @@ -136,7 +134,7 @@ # Write outputs to files in the `.github/outputs` folder by # default. - # Default: false + # Default: `"false"` write_output_files: '' ``` diff --git a/test/README-codeBlocksMajorVersion.md b/test/README-codeBlocksMajorVersion.md index 4aab00f..f49fd35 100644 --- a/test/README-codeBlocksMajorVersion.md +++ b/test/README-codeBlocksMajorVersion.md @@ -17,7 +17,7 @@ # Output unique changed directories instead of filenames. **NOTE:** This # returns `.` for changed files located in the root # of the project. - # Default: false + # Default: `"false"` dir_names: '' # Maximum depth of directories to output. e.g `test/test1/test2` with @@ -26,7 +26,7 @@ # Depth of additional branch history fetched. **NOTE**: This can # be adjusted to resolve errors with insufficient history. - # Default: 50 + # Default: `"50"` fetch_depth: '' # File and directory patterns to detect changes using only @@ -45,70 +45,68 @@ files_ignore_from_source_file: '' # Separator used to split the `files_ignore` input - # Default: - + # Default: `"\n"` files_ignore_separator: '' # Separator used to split the `files` input - # Default: - + # Default: `"\n"` files_separator: '' # Include `all_old_new_renamed_files` output. Note this can generate a large # output See: [#501](https://github.com/tj-actions/changed-files/issues/501). - # Default: false + # Default: `"false"` include_all_old_new_renamed_files: '' # Output list of changed files in a JSON formatted # string which can be used for matrix jobs. - # Default: false + # Default: `"false"` json: '' # Output list of changed files in a raw format # which means that the output will not be surrounded # by quotes and special characters will not be escaped. - # Default: false + # Default: `"false"` # Deprecated: Use `json_unescaped` instead. json_raw_format: '' # Output list of changed files in a JSON formatted # string without escaping special characters. - # Default: false + # Default: `"false"` json_unescaped: '' # Boolean indicating whether to output input, output and secret # names as markdown links - # Default: false + # Default: `"false"` markdown_links: '' # Indicates whether to include match directories - # Default: true + # Default: `"true"` match_directories: '' # Split character for old and new renamed filename pairs. - # Default: + # Default: `" "` old_new_files_separator: '' # Split character for old and new filename pairs. - # Default: , + # Default: `","` old_new_separator: '' # Directory to store output files. - # Default: .github/outputs + # Default: `".github/outputs"` output_dir: '' # Specify a relative path under `$GITHUB_WORKSPACE` to locate the # repository. - # Default: . + # Default: `"."` path: '' # Use non ascii characters to match files and output # the filenames completely verbatim by setting this to `false` - # Default: true + # Default: `"true"` quotepath: '' # Split character for output strings. - # Default: + # Default: `" "` separator: '' # Specify a different commit SHA used for comparing changes @@ -123,11 +121,11 @@ # on the target branch for pull request events and # the previous remote commit of the current branch for # push events. - # Default: false + # Default: `"false"` since_last_remote_commit: '' # The GitHub token to use for authentication. - # Default: ${{ github.token }} + # Default: `"${{ github.token }}"` token: '' # Get changed files for commits whose timestamp is earlier @@ -136,7 +134,7 @@ # Write outputs to files in the `.github/outputs` folder by # default. - # Default: false + # Default: `"false"` write_output_files: '' ```