Skip to content

Commit

Permalink
Formatted code.
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Mar 9, 2023
1 parent 39668ba commit 57a2454
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 28 deletions.
18 changes: 16 additions & 2 deletions internal/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,58 @@ import "fmt"

// InputsHeader represents the markdown header of inputs
const InputsHeader = "## Inputs"

// OutputsHeader represents the markdown header of outputs
const OutputsHeader = "## Outputs"

// SecretsHeader represents the markdown header of secrets
const SecretsHeader = "## Secrets"

// AutoDocStart placeholder that represents the start of the input table
const AutoDocStart = "<!-- AUTO-DOC-%s:START - Do not remove or modify this section -->"

// AutoDocEnd placeholder that represents the end of the input table
const AutoDocEnd = "<!-- AUTO-DOC-%s:END -->"

// PipeSeparator represents the separator used for the distinguishing between columns
const PipeSeparator = "|"

// NewLineSeparator used for splitting lines
const NewLineSeparator = "\n"

// InputAutoDocStart is the start of the input
var InputAutoDocStart = fmt.Sprintf(AutoDocStart, "INPUT")

// InputAutoDocEnd is the end of the input
var InputAutoDocEnd = fmt.Sprintf(AutoDocEnd, "INPUT")

// OutputAutoDocStart is the start of the output
var OutputAutoDocStart = fmt.Sprintf(AutoDocStart, "OUTPUT")

// OutputAutoDocEnd is the end of the output
var OutputAutoDocEnd = fmt.Sprintf(AutoDocEnd, "OUTPUT")

// SecretsAutoDocStart is the start of the secrets
var SecretsAutoDocStart = fmt.Sprintf(AutoDocStart, "SECRETS")

// SecretsAutoDocEnd is the end of the secrets
var SecretsAutoDocEnd = fmt.Sprintf(AutoDocEnd, "SECRETS")

// action.yml

// DefaultActionInputColumns default values
var DefaultActionInputColumns = []string{"Input", "Type", "Required", "Default", "Description"}

// DefaultActionOutputColumns default values
var DefaultActionOutputColumns = []string{"Output", "Type", "Description"}


// Reusable workflows

// DefaultReusableSecretColumns default values
var DefaultReusableSecretColumns = []string{"Secret", "Required", "Description"}

// DefaultReusableOutputColumns default values
var DefaultReusableOutputColumns = []string{"Output", "Value", "Description"}

// DefaultReusableInputColumns default values
var DefaultReusableInputColumns = []string{"Input", "Type", "Required", "Default", "Description"}
var DefaultReusableInputColumns = []string{"Input", "Type", "Required", "Default", "Description"}
20 changes: 10 additions & 10 deletions internal/types/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ type ActionOutput struct {

// Action represents the action.yml
type Action struct {
InputFileName string
InputFileName string
OutputFileName string
ColMaxWidth string
ColMaxWords string
InputColumns []string
OutputColumns []string
Inputs map[string]ActionInput `yaml:"inputs,omitempty"`
Outputs map[string]ActionOutput `yaml:"outputs,omitempty"`
ColMaxWidth string
ColMaxWords string
InputColumns []string
OutputColumns []string
Inputs map[string]ActionInput `yaml:"inputs,omitempty"`
Outputs map[string]ActionOutput `yaml:"outputs,omitempty"`
}

// GetData parses the source yaml file
Expand Down Expand Up @@ -145,7 +145,7 @@ func (a *Action) RenderOutput() error {
}

// renderActionOutputTableOutput renders the action input table
func renderActionInputTableOutput(i map[string]ActionInput, inputColumns[]string, maxWidth int, maxWords int) (*strings.Builder, error) {
func renderActionInputTableOutput(i map[string]ActionInput, inputColumns []string, maxWidth int, maxWords int) (*strings.Builder, error) {
inputTableOutput := &strings.Builder{}

if len(i) > 0 {
Expand Down Expand Up @@ -215,7 +215,7 @@ func renderActionInputTableOutput(i map[string]ActionInput, inputColumns[]string
}

// renderActionOutputTableOutput renders the action output table
func renderActionOutputTableOutput(o map[string]ActionOutput, outputColumns[]string, maxWidth int, maxWords int) (*strings.Builder, error) {
func renderActionOutputTableOutput(o map[string]ActionOutput, outputColumns []string, maxWidth int, maxWords int) (*strings.Builder, error) {
outputTableOutput := &strings.Builder{}

if len(o) > 0 {
Expand Down Expand Up @@ -276,4 +276,4 @@ func renderActionOutputTableOutput(o map[string]ActionOutput, outputColumns[]str
}
}
return outputTableOutput, nil
}
}
2 changes: 1 addition & 1 deletion internal/types/documentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ package types
type Documentation interface {
GetData() error
RenderOutput() error
}
}
26 changes: 13 additions & 13 deletions internal/types/reusable.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ type ReusableSecret struct {

// Reusable represents the reusable workflow yaml
type Reusable struct {
InputFileName string
InputFileName string
OutputFileName string
ColMaxWidth string
ColMaxWords string
InputColumns []string
OutputColumns []string
SecretColumns []string
On struct {
ColMaxWidth string
ColMaxWords string
InputColumns []string
OutputColumns []string
SecretColumns []string
On struct {
WorkflowCall struct {
Inputs map[string]ReusableInput `yaml:"inputs,omitempty"`
Secrets map[string]ReusableSecret `yaml:"secrets,omitempty"`
Inputs map[string]ReusableInput `yaml:"inputs,omitempty"`
Secrets map[string]ReusableSecret `yaml:"secrets,omitempty"`
Outputs map[string]ReusableOutput `yaml:"outputs,omitempty"`
} `yaml:"workflow_call"`
}
Expand Down Expand Up @@ -175,7 +175,7 @@ func (r *Reusable) RenderOutput() error {
}

// renderReusableInputTableOutput renders the reusable workflow input table
func renderReusableInputTableOutput(i map[string]ReusableInput, inputColumns[]string, maxWidth int, maxWords int) (*strings.Builder, error) {
func renderReusableInputTableOutput(i map[string]ReusableInput, inputColumns []string, maxWidth int, maxWords int) (*strings.Builder, error) {
inputTableOutput := &strings.Builder{}

if len(i) > 0 {
Expand Down Expand Up @@ -245,7 +245,7 @@ func renderReusableInputTableOutput(i map[string]ReusableInput, inputColumns[]st
}

// renderReusableOutputTableOutput renders the reusable workflow output table
func renderReusableOutputTableOutput(o map[string]ReusableOutput, reusableOutputColumns[]string, maxWidth int, maxWords int) (*strings.Builder, error) {
func renderReusableOutputTableOutput(o map[string]ReusableOutput, reusableOutputColumns []string, maxWidth int, maxWords int) (*strings.Builder, error) {
outputTableOutput := &strings.Builder{}

if len(o) > 0 {
Expand Down Expand Up @@ -309,7 +309,7 @@ func renderReusableOutputTableOutput(o map[string]ReusableOutput, reusableOutput
}

// renderReusableSecretTableOutput renders the reusable workflow secret table
func renderReusableSecretTableOutput(s map[string]ReusableSecret, secretColumns[]string, maxWidth int, maxWords int) (*strings.Builder, error) {
func renderReusableSecretTableOutput(s map[string]ReusableSecret, secretColumns []string, maxWidth int, maxWords int) (*strings.Builder, error) {
secretTableOutput := &strings.Builder{}

if len(s) > 0 {
Expand Down Expand Up @@ -369,4 +369,4 @@ func renderReusableSecretTableOutput(s map[string]ReusableSecret, secretColumns[
}
}
return secretTableOutput, nil
}
}
2 changes: 1 addition & 1 deletion internal/utils/format_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ func FormatValue(v string) string {
}

return defaultValue
}
}
2 changes: 1 addition & 1 deletion internal/utils/word_wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ func WordWrap(s string, limit int) string {
result = strings.TrimSuffix(result, "<br>")

return strings.TrimSpace(result)
}
}

0 comments on commit 57a2454

Please sign in to comment.