Skip to content

Commit

Permalink
fix: properly escape default values (#523)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
jackton1 and github-actions[bot] authored Nov 15, 2023
1 parent b3db267 commit c878815
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 52 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -89,19 +89,19 @@ 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
# (display all columns)
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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/types/code_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
40 changes: 19 additions & 21 deletions test/README-codeBlocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -136,7 +134,7 @@

# Write outputs to files in the `.github/outputs` folder by
# default.
# Default: false
# Default: `"false"`
write_output_files: ''

```
Expand Down
40 changes: 19 additions & 21 deletions test/README-codeBlocksMajorVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -136,7 +134,7 @@

# Write outputs to files in the `.github/outputs` folder by
# default.
# Default: false
# Default: `"false"`
write_output_files: ''

```
Expand Down

0 comments on commit c878815

Please sign in to comment.