Skip to content

Commit

Permalink
Merge pull request #92 from issue-ops/ncalteen/issue-parser
Browse files Browse the repository at this point in the history
Convert to use @github/issue-parser
  • Loading branch information
ncalteen authored Nov 5, 2024
2 parents 1991c19 + f23e674 commit 930076f
Show file tree
Hide file tree
Showing 22 changed files with 1,015 additions and 1,037 deletions.
12 changes: 12 additions & 0 deletions .markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
MD003: false
MD004:
style: dash
MD013:
tables: false
MD026: false
MD029:
style: one
MD033: false
MD034: false
MD036: false
MD041: false
3 changes: 2 additions & 1 deletion .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DISABLE:
# https://megalinter.io/latest/config-activation/
DISABLE_LINTERS:
- MARKDOWN_MARKDOWN_TABLE_FORMATTER
- REPOSITORY_GRYPE
- REPOSITORY_KICS
- REPOSITORY_TRIVY
- TYPESCRIPT_STANDARD
Expand Down Expand Up @@ -137,7 +138,7 @@ VALIDATE_ALL_CODEBASE: true
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.yml
JAVASCRIPT_PRETTIER_CONFIG_FILE: prettierrc.yml
JSON_PRETTIER_CONFIG_FILE: prettierrc.yml
MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdownlint.yml
MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdown-lint.yml
TYPESCRIPT_ES_CONFIG_FILE: .eslintrc.yml
TYPESCRIPT_PRETTIER_CONFIG_FILE: .prettierrc.yml
YAML_PRETTIER_CONFIG_FILE: .prettierrc.yml
Expand Down
65 changes: 51 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ steps:

## Example

Given an [example issue template](./__fixtures__/example/template.yml) and the
following issue submitted with that template:
Given an
[example issue template](./__fixtures__/example/.github/ISSUE_TEMPLATE/template.yml)
and the following issue submitted with that template:

```markdown
### The Name of the Thing
Expand Down Expand Up @@ -132,31 +133,67 @@ IssueOps-Demo-Writers-NotATeam

The output of this action would be:

<!-- markdownlint-disable -->

```json
{
"the_name_of_the_thing": "this-thing",
"the_nickname_of_the_thing": "thing",
"the_color_of_the_thing": ["blue"],
"the_shape_of_the_thing": ["square"],
"the_sounds_of_the_thing": ["re", "mi"],
"the_topics_about_the_thing": [],
"the_description_of_the_thing": "This is a description.\n\nIt has lines.",
"the_notes_about_the_thing": "- Note\n- Another note\n- Lots of notes",
"the_code_of_the_thing": "const thing = new Thing()\n\nthing.doThing()",
"the_string_method_of_the_code_of_the_thing": "thing.toString()",
"is_the_thing_a_thing": {
"name": "this-thing",
"nickname": "thing",
"color": ["blue"],
"shape": ["square"],
"sounds": ["re", "mi"],
"topics": [],
"description": "This is a description.\n\nIt has multiple lines.\n\nIt's pretty cool!",
"notes": "- Note\n- Another note\n- Lots of notes",
"code": "const thing = new Thing()\nthing.doThing()",
"code-string": "thing.toString()",
"is-thing": {
"selected": ["Yes"],
"unselected": ["No"]
},
"is_the_thing_useful": {
"is-thing-useful": {
"selected": ["Sometimes"],
"unselected": ["Yes", "No"]
},
"read-team": "IssueOps-Demo-Readers",
"write-team": "IssueOps-Demo-Writers"
}
```

<!-- markdownlint-enable -->

### No Template Provided

The `issue-form-template` input is optional. If not provided, the action will
still parse the issue body, however the output will be a flat JSON object. The
object keys will be slugified versions of the headers, and the values will be
the contents of the headers.

Using the same example as above, the output would instead be:

<!-- markdownlint-disable -->

```json
{
"the_name_of_the_thing": "this-thing",
"the_nickname_of_the_thing": "thing",
"the_color_of_the_thing": "blue",
"the_shape_of_the_thing": "square",
"the_sounds_of_the_thing": "re, mi",
"the_topics_about_the_thing": "_No response_",
"the_description_of_the_thing": "This is a description.\n\nIt has multiple lines.\n\nIt's pretty cool!",
"the_notes_about_the_thing": "- Note\n- Another note\n- Lots of notes",
"the_code_of_the_thing": "const thing = new Thing()\nthing.doThing()",
"the_string_method_of_the_code_of_the_thing": "thing.toString()",
"is_the_thing_a_thing": "- [x] Yes\n- [ ] No",
"is_the_thing_useful": "- [ ] Yes\n- [x] Sometimes\n- [ ] No",
"read_team": "IssueOps-Demo-Readers",
"write_team": "IssueOps-Demo-Writers"
}
```

<!-- markdownlint-enable -->

## Transformations

### Headings
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions __fixtures__/example/parsed-issue-no-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"the_name_of_the_thing": "this-thing",
"the_nickname_of_the_thing": "thing",
"the_color_of_the_thing": "blue",
"the_shape_of_the_thing": "square",
"the_sounds_of_the_thing": "re, mi",
"the_topics_about_the_thing": "_No response_",
"the_description_of_the_thing": "This is a description.\n\nIt has multiple lines.\n\nIt's pretty cool!",
"the_notes_about_the_thing": "- Note\n- Another note\n- Lots of notes",
"the_code_of_the_thing": "const thing = new Thing()\nthing.doThing()",
"the_string_method_of_the_code_of_the_thing": "thing.toString()",
"is_the_thing_a_thing": "- [x] Yes\n- [ ] No",
"is_the_thing_useful": "- [ ] Yes\n- [x] Sometimes\n- [ ] No",
"read_team": "IssueOps-Demo-Readers",
"write_team": "IssueOps-Demo-Writers"
}
File renamed without changes.
90 changes: 0 additions & 90 deletions __fixtures__/example/parsed-template.json

This file was deleted.

148 changes: 0 additions & 148 deletions __tests__/format.test.ts

This file was deleted.

Loading

0 comments on commit 930076f

Please sign in to comment.