Skip to content

Commit

Permalink
Merge b3fbb69 into 28b9e67
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Feb 5, 2022
2 parents 28b9e67 + b3fbb69 commit 971fefc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ Add the `Inputs` and/or `Outputs` [`H2` header](https://github.com/adam-p/markdo

| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|---------------|--------|----------|----------------|---------------------------------------------|
| action | string | false | `"action.yml"` | Path to the action.yml file<br> |
| col\_max\_width | string | false | `"1000"` | Max width of a column<br> |
| col\_max\_words | string | false | `"5"` | Max number of words per<br>line in a column |
| output | string | false | `"README.md"` | Path to the output file<br> |
| action | string | false | "`action.yml`" | Path to the action.yml file<br> |
| col\_max\_width | string | false | "`1000`" | Max width of a column<br> |
| col\_max\_words | string | false | "`5`" | Max number of words per<br>line in a column |
| output | string | false | "`README.md`" | Path to the output file<br> |

<!-- AUTO-DOC-INPUT:END -->

Expand Down
13 changes: 10 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var inputsHeader = "## Inputs"
var outputsHeader = "## Outputs"
var autoDocStart = "<!-- AUTO-DOC-%s:START - Do not remove or modify this section -->"
var autoDocEnd = "<!-- AUTO-DOC-%s:END -->"
var pipeSeparator = "|"
var inputAutoDocStart = fmt.Sprintf(autoDocStart, "INPUT")
var inputAutoDocEnd = fmt.Sprintf(autoDocEnd, "INPUT")
var outputAutoDocStart = fmt.Sprintf(autoDocStart, "OUTPUT")
Expand Down Expand Up @@ -92,7 +93,7 @@ func (a *Action) renderOutput() error {
inputTable := tablewriter.NewWriter(inputTableOutput)
inputTable.SetHeader([]string{"Input", "Type", "Required", "Default", "Description"})
inputTable.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
inputTable.SetCenterSeparator("|")
inputTable.SetCenterSeparator(pipeSeparator)

keys := make([]string, 0, len(a.Inputs))
for k := range a.Inputs {
Expand All @@ -105,7 +106,13 @@ func (a *Action) renderOutput() error {
for _, key := range keys {
var outputDefault string
if len(a.Inputs[key].Default) > 0 {
outputDefault = fmt.Sprintf("`\"%s\"`", a.Inputs[key].Default)
outputDefault = a.Inputs[key].Default

if outputDefault == pipeSeparator {
outputDefault = "\\" + outputDefault
}

outputDefault = "`\"" + outputDefault + "\"`"
}
row := []string{key, "string", strconv.FormatBool(a.Inputs[key].Required), outputDefault, wordWrap(a.Inputs[key].Description, maxWords)}
inputTable.Append(row)
Expand Down Expand Up @@ -140,7 +147,7 @@ func (a *Action) renderOutput() error {
outputTable := tablewriter.NewWriter(outputTableOutput)
outputTable.SetHeader([]string{"Output", "Type", "Description"})
outputTable.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
outputTable.SetCenterSeparator("|")
outputTable.SetCenterSeparator(pipeSeparator)

keys := make([]string, 0, len(a.Outputs))
for k := range a.Outputs {
Expand Down
6 changes: 3 additions & 3 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
| base_sha | string | false | | Specify a base commit SHA<br>used for comparing changes |
| files | string | false | | Check for changes using only<br>this list of files (Defaults<br>to the entire repo) |
| path | string | false | | Specify a relative path under<br>$GITHUB_WORKSPACE to locate the repository<br> |
| separator | string | true | `" "` | Split character for array output<br> |
| sha | string | true | `"${{ github.sha }}"` | Specify a current commit SHA<br>used for comparing changes |
| token | string | true | `"${{ github.token }}"` | Github token or Repo Scoped<br>Personal Access Token |
| separator | string | true | "`\|`" | Split character for array output<br> |
| sha | string | true | "`${{ github.sha }}`" | Specify a current commit SHA<br>used for comparing changes |
| token | string | true | "`${{ github.token }}`" | Github token or Repo Scoped<br>Personal Access Token |

<!-- AUTO-DOC-INPUT:END -->

Expand Down
2 changes: 1 addition & 1 deletion test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
separator:
description: 'Split character for array output'
required: true
default: " "
default: "|"
files:
description: 'Check for changes using only this list of files (Defaults to the entire repo)'
required: false
Expand Down

0 comments on commit 971fefc

Please sign in to comment.