File tree 5 files changed +259
-11
lines changed
5 files changed +259
-11
lines changed Original file line number Diff line number Diff line change
1
+ name : ci
2
+
3
+ on :
4
+ - push
5
+
6
+ jobs :
7
+ build :
8
+ runs-on : ubuntu-latest
9
+ steps :
10
+ - uses : actions/checkout@v2
11
+ - run : make test
12
+ - name : automerge
13
+ uses : mhristof/github-action-automerge@v1.0.1
14
+ with :
15
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
16
+
17
+
Original file line number Diff line number Diff line change @@ -48,21 +48,24 @@ var md = `# {{ .Name }}
48
48
49
49
{{ .Description }}
50
50
51
+ {{ if .Inputs -}}
51
52
## Inputs
52
53
53
54
| Name | Description | Default | Required |
54
55
| ---- | ----------- | ------- | -------- |
55
56
{{ range $key, $value := .Inputs -}}
56
57
| {{ $key }} | {{$value.Description}} | {{$value.Default }} | {{ $value.Required }}|
57
58
{{ end }}
58
-
59
+ {{ end -}}
60
+ {{ if .Outputs -}}
59
61
## Outputs
60
62
61
63
| Name | Description |
62
64
| ---- | ----------- |
63
65
{{ range $key, $value := .Outputs -}}
64
66
| {{ $key }} | {{$value.Description}} |
65
- {{ end }}`
67
+ {{ end }}
68
+ {{ end -}}`
66
69
67
70
func (c * Config ) Markdown () string {
68
71
tmpl , err := template .New ("markdown" ).Parse (md )
Original file line number Diff line number Diff line change @@ -69,12 +69,59 @@ func TestMarkdown(t *testing.T) {
69
69
| ---- | ----------- | ------- | -------- |
70
70
| who-to-greet | Who to greet | World | true|
71
71
72
+ ## Outputs
73
+
74
+ | Name | Description |
75
+ | ---- | ----------- |
76
+ | random-number | Random number |
77
+
78
+ ` ),
79
+ },
80
+ {
81
+ name : "no outputs" ,
82
+ yaml : heredoc .Doc (`
83
+ name: 'Hello World'
84
+ description: 'Greet someone'
85
+ inputs:
86
+ who-to-greet: # id of input
87
+ description: 'Who to greet'
88
+ required: true
89
+ default: 'World'
90
+ ` ),
91
+ expected : heredoc .Doc (`
92
+ # Hello World
93
+
94
+ Greet someone
95
+
96
+ ## Inputs
72
97
98
+ | Name | Description | Default | Required |
99
+ | ---- | ----------- | ------- | -------- |
100
+ | who-to-greet | Who to greet | World | true|
101
+
102
+ ` ),
103
+ },
104
+ {
105
+ name : "no inputs" ,
106
+ yaml : heredoc .Doc (`
107
+ name: 'Hello World'
108
+ description: 'Greet someone'
109
+ outputs:
110
+ random-number:
111
+ description: "Random number"
112
+ value: ${{ steps.random-number-generator.outputs.random-id }}
113
+ ` ),
114
+ expected : heredoc .Doc (`
115
+ # Hello World
116
+
117
+ Greet someone
118
+
73
119
## Outputs
74
120
75
121
| Name | Description |
76
122
| ---- | ----------- |
77
123
| random-number | Random number |
124
+
78
125
` ),
79
126
},
80
127
}
Original file line number Diff line number Diff line change 1
1
module github.com/mhristof/githubactions-docs
2
2
3
- go 1.14
3
+ go 1.16
4
4
5
5
require (
6
6
github.com/MakeNowJust/heredoc v1.0.0
7
- github.com/atsushinee/go-markdown-generator v0.0.0-20191121114853-83f9e1f68504
8
7
github.com/mhristof/go-update v0.1.0
9
8
github.com/riywo/#shell v0.0.0-20200815045211-7d26008be1ab
10
- github.com/sirupsen/logrus v1.5.0
11
- github.com/spf13/cobra v1.0.0
12
- github.com/stretchr/testify v1.5.1
13
- gopkg.in/yaml.v2 v2.2.8
9
+ github.com/sirupsen/logrus v1.8.1
10
+ github.com/spf13/cobra v1.1.3
11
+ github.com/stretchr/testify v1.7.0
12
+ gopkg.in/yaml.v2 v2.4.0
14
13
)
You can’t perform that action at this time.
0 commit comments