Skip to content

Commit

Permalink
feat: add support for including the type (#527)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 19, 2023
1 parent 96a77dd commit df45e1b
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,71 +71,88 @@ and/or `Description` (only supported by actions)
id: auto-doc
with:
# Optionally pass a path to the auto-doc binary
# Type: string
bin_path: ''

# Max width of a column
# Type: string
# Default: "1000"
col_max_width: ''

# Max number of words per line in a column
# Type: string
# Default: "5"
col_max_words: ''

# Path to the yaml file
# Type: string
# Default: "action.yml"
filename: ''

# List of action.yml **input** columns names to display, default
# (display all columns)
# Type: string
input_columns: ''

# Boolean indicating whether to output input, output and secret
# names as markdown links
# Type: boolean
# Default: "true"
markdown_links: ''

# Path to the output file
# Type: string
# Default: "README.md"
output: ''

# List of action.yml **output** column names to display, default
# (display all columns)
# Type: string
output_columns: ''

# Repository name with owner. For example, tj-actions/auto-doc
# Type: string
# Default: "${{ github.repository }}"
repository: ''

# Boolean Indicating whether the file is a reusable workflow
# Type: string
reusable: ''

# List of reusable workflow **input** column names to display,
# default (display all columns)
# Type: string
reusable_input_columns: ''

# List of reusable workflow **output** column names to display,
# default (display all columns)
# Type: string
reusable_output_columns: ''

# List of reusable workflow **secret** column names to display,
# default (display all columns)
# Type: string
reusable_secret_columns: ''

# GitHub token or Personal Access Token used to fetch
# the repository latest tag.
# Type: string
# Default: "${{ github.token }}"
token: ''

# Enable code block documentation
# Type: boolean
# Default: "false"
use_code_blocks: ''

# Use the major version of the repository tag e.g
# v1.0.0 -> v1
# Type: boolean
# Default: "false"
use_major_version: ''

# The version number to run
# Type: string
version: ''

```
Expand Down
5 changes: 5 additions & 0 deletions internal/types/code_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ 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 == "false" || inputs[key].Default == "true" {
codeBlock.WriteString(" # Type: boolean\n")
} else {
codeBlock.WriteString(" # Type: string\n")
}
if inputs[key].Default != "" {
codeBlock.WriteString(fmt.Sprintf(" # Default: %s\n", utils.FormatValue(inputs[key].Default, false, "\n # ")))
}
Expand Down
29 changes: 29 additions & 0 deletions test/README-codeBlocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,137 +7,166 @@
with:
# Specify a different base commit SHA used for comparing
# changes
# Type: string
base_sha: ''

# Exclude changes outside the current directory and show path
# names relative to it. **NOTE:** This requires you to
# specify the top level directory via the `path` input.
# Type: string
diff_relative: ''

# Output unique changed directories instead of filenames. **NOTE:** This
# returns `.` for changed files located in the root
# of the project.
# Type: boolean
# Default: "false"
dir_names: ''

# Maximum depth of directories to output. e.g `test/test1/test2` with
# max depth of `2` returns `test/test1`.
# Type: string
dir_names_max_depth: ''

# Depth of additional branch history fetched. **NOTE**: This can
# be adjusted to resolve errors with insufficient history.
# Type: string
# Default: "50"
fetch_depth: ''

# File and directory patterns to detect changes using only
# these list of file(s) (Defaults to the entire repo) **NOTE:** Multiline file/directory patterns
# should not include quotes.
# Type: string
# Default: a.txt
# b.txt
# test.txt
#
files: ''

# Source file(s) used to populate the `files` input.
# Type: string
files_from_source_file: ''

# Ignore changes to these file(s) **NOTE:** Multiline file/directory patterns
# should not include quotes.
# Type: string
files_ignore: ''

# Source file(s) used to populate the `files_ignore` input
# Type: string
files_ignore_from_source_file: ''

# Separator used to split the `files_ignore` input
# Type: string
# Default: "\n"
files_ignore_separator: ''

# Separator used to split the `files` input
# Type: string
# 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).
# Type: boolean
# 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.
# Type: boolean
# 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.
# Type: boolean
# Default: "false"
# Deprecated: Use `json_unescaped` instead.
json_raw_format: ''

# Output list of changed files in a JSON formatted
# string without escaping special characters.
# Type: boolean
# Default: "false"
json_unescaped: ''

# Boolean indicating whether to output input, output and secret
# names as markdown links
# Type: boolean
# Default: "false"
markdown_links: ''

# Indicates whether to include match directories
# Type: boolean
# Default: "true"
match_directories: ''

# Split character for old and new renamed filename pairs.
# Type: string
# Default: " "
old_new_files_separator: ''

# Split character for old and new filename pairs.
# Type: string
# Default: ","
old_new_separator: ''

# Directory to store output files.
# Type: string
# Default: ".github/outputs"
output_dir: ''

# Specify a relative path under `$GITHUB_WORKSPACE` to locate the
# repository.
# Type: string
# Default: "."
path: ''

# Use non ascii characters to match files and output
# the filenames completely verbatim by setting this to `false`
# Type: boolean
# Default: "true"
quotepath: ''

# Split character for output strings.
# Type: string
# Default: "|"
separator: ''

# Specify a different commit SHA used for comparing changes
# Type: string
sha: ''

# Get changed files for commits whose timestamp is older
# than the given time.
# Type: string
since: ''

# Use the last commit on the remote branch as
# the `base_sha`. Defaults to the last non merge commit
# on the target branch for pull request events and
# the previous remote commit of the current branch for
# push events.
# Type: boolean
# Default: "false"
since_last_remote_commit: ''

# The GitHub token to use for authentication.
# Type: string
# Default: "${{ github.token }}"
token: ''

# Get changed files for commits whose timestamp is earlier
# than the given time.
# Type: string
until: ''

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

Expand Down
Loading

0 comments on commit df45e1b

Please sign in to comment.