Skip to content

Commit 930076f

Browse files
authored
Merge pull request #92 from issue-ops/ncalteen/issue-parser
Convert to use @github/issue-parser
2 parents 1991c19 + f23e674 commit 930076f

22 files changed

+1015
-1037
lines changed

.markdown-lint.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
MD003: false
2+
MD004:
3+
style: dash
4+
MD013:
5+
tables: false
6+
MD026: false
7+
MD029:
8+
style: one
9+
MD033: false
10+
MD034: false
11+
MD036: false
12+
MD041: false

.mega-linter.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DISABLE:
2020
# https://megalinter.io/latest/config-activation/
2121
DISABLE_LINTERS:
2222
- MARKDOWN_MARKDOWN_TABLE_FORMATTER
23+
- REPOSITORY_GRYPE
2324
- REPOSITORY_KICS
2425
- REPOSITORY_TRIVY
2526
- TYPESCRIPT_STANDARD
@@ -137,7 +138,7 @@ VALIDATE_ALL_CODEBASE: true
137138
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.yml
138139
JAVASCRIPT_PRETTIER_CONFIG_FILE: prettierrc.yml
139140
JSON_PRETTIER_CONFIG_FILE: prettierrc.yml
140-
MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdownlint.yml
141+
MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdown-lint.yml
141142
TYPESCRIPT_ES_CONFIG_FILE: .eslintrc.yml
142143
TYPESCRIPT_PRETTIER_CONFIG_FILE: .prettierrc.yml
143144
YAML_PRETTIER_CONFIG_FILE: .prettierrc.yml

README.md

+51-14
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ steps:
6060

6161
## Example
6262

63-
Given an [example issue template](./__fixtures__/example/template.yml) and the
64-
following issue submitted with that template:
63+
Given an
64+
[example issue template](./__fixtures__/example/.github/ISSUE_TEMPLATE/template.yml)
65+
and the following issue submitted with that template:
6566

6667
```markdown
6768
### The Name of the Thing
@@ -132,31 +133,67 @@ IssueOps-Demo-Writers-NotATeam
132133

133134
The output of this action would be:
134135

136+
<!-- markdownlint-disable -->
137+
135138
```json
136139
{
137-
"the_name_of_the_thing": "this-thing",
138-
"the_nickname_of_the_thing": "thing",
139-
"the_color_of_the_thing": ["blue"],
140-
"the_shape_of_the_thing": ["square"],
141-
"the_sounds_of_the_thing": ["re", "mi"],
142-
"the_topics_about_the_thing": [],
143-
"the_description_of_the_thing": "This is a description.\n\nIt has lines.",
144-
"the_notes_about_the_thing": "- Note\n- Another note\n- Lots of notes",
145-
"the_code_of_the_thing": "const thing = new Thing()\n\nthing.doThing()",
146-
"the_string_method_of_the_code_of_the_thing": "thing.toString()",
147-
"is_the_thing_a_thing": {
140+
"name": "this-thing",
141+
"nickname": "thing",
142+
"color": ["blue"],
143+
"shape": ["square"],
144+
"sounds": ["re", "mi"],
145+
"topics": [],
146+
"description": "This is a description.\n\nIt has multiple lines.\n\nIt's pretty cool!",
147+
"notes": "- Note\n- Another note\n- Lots of notes",
148+
"code": "const thing = new Thing()\nthing.doThing()",
149+
"code-string": "thing.toString()",
150+
"is-thing": {
148151
"selected": ["Yes"],
149152
"unselected": ["No"]
150153
},
151-
"is_the_thing_useful": {
154+
"is-thing-useful": {
152155
"selected": ["Sometimes"],
153156
"unselected": ["Yes", "No"]
154157
},
158+
"read-team": "IssueOps-Demo-Readers",
159+
"write-team": "IssueOps-Demo-Writers"
160+
}
161+
```
162+
163+
<!-- markdownlint-enable -->
164+
165+
### No Template Provided
166+
167+
The `issue-form-template` input is optional. If not provided, the action will
168+
still parse the issue body, however the output will be a flat JSON object. The
169+
object keys will be slugified versions of the headers, and the values will be
170+
the contents of the headers.
171+
172+
Using the same example as above, the output would instead be:
173+
174+
<!-- markdownlint-disable -->
175+
176+
```json
177+
{
178+
"the_name_of_the_thing": "this-thing",
179+
"the_nickname_of_the_thing": "thing",
180+
"the_color_of_the_thing": "blue",
181+
"the_shape_of_the_thing": "square",
182+
"the_sounds_of_the_thing": "re, mi",
183+
"the_topics_about_the_thing": "_No response_",
184+
"the_description_of_the_thing": "This is a description.\n\nIt has multiple lines.\n\nIt's pretty cool!",
185+
"the_notes_about_the_thing": "- Note\n- Another note\n- Lots of notes",
186+
"the_code_of_the_thing": "const thing = new Thing()\nthing.doThing()",
187+
"the_string_method_of_the_code_of_the_thing": "thing.toString()",
188+
"is_the_thing_a_thing": "- [x] Yes\n- [ ] No",
189+
"is_the_thing_useful": "- [ ] Yes\n- [x] Sometimes\n- [ ] No",
155190
"read_team": "IssueOps-Demo-Readers",
156191
"write_team": "IssueOps-Demo-Writers"
157192
}
158193
```
159194

195+
<!-- markdownlint-enable -->
196+
160197
## Transformations
161198

162199
### Headings
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"the_name_of_the_thing": "this-thing",
3+
"the_nickname_of_the_thing": "thing",
4+
"the_color_of_the_thing": "blue",
5+
"the_shape_of_the_thing": "square",
6+
"the_sounds_of_the_thing": "re, mi",
7+
"the_topics_about_the_thing": "_No response_",
8+
"the_description_of_the_thing": "This is a description.\n\nIt has multiple lines.\n\nIt's pretty cool!",
9+
"the_notes_about_the_thing": "- Note\n- Another note\n- Lots of notes",
10+
"the_code_of_the_thing": "const thing = new Thing()\nthing.doThing()",
11+
"the_string_method_of_the_code_of_the_thing": "thing.toString()",
12+
"is_the_thing_a_thing": "- [x] Yes\n- [ ] No",
13+
"is_the_thing_useful": "- [ ] Yes\n- [x] Sometimes\n- [ ] No",
14+
"read_team": "IssueOps-Demo-Readers",
15+
"write_team": "IssueOps-Demo-Writers"
16+
}

__fixtures__/example/parsed-template.json

-90
This file was deleted.

__tests__/format.test.ts

-148
This file was deleted.

0 commit comments

Comments
 (0)