Skip to content

Commit

Permalink
Merge pull request #81 from issue-ops/ncalteen/fields
Browse files Browse the repository at this point in the history
Default to template field ID for parsed issue body key
  • Loading branch information
ncalteen authored Aug 29, 2024
2 parents ed039d8 + d7a85a2 commit 3d1d383
Show file tree
Hide file tree
Showing 40 changed files with 14,786 additions and 14,425 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extends:
- plugin:prettier/recommended

rules:
'@typescript-eslint/no-explicit-any': off
camelcase: off
eslint-comments/no-use: off
eslint-comments/no-unused-disable: off
Expand Down
4 changes: 2 additions & 2 deletions .github/validator/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
validators:
- field: read_team
- field: read-team
script: team
- field: write_team
- field: write-team
script: team
2 changes: 1 addition & 1 deletion .github/workflows/issue-created.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
# Parse the issue body and convert it to JSON.
- name: Parse Issue Body
id: parse
uses: issue-ops/parser@v1.0.0
uses: issue-ops/parser@v3
with:
body: ${{ github.event.issue.body }}
issue-form-template: example-request.yml
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ Thumbs.db
# Extra
tmp/
linter/
.env
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ node_modules/
*.scss
dist/
coverage/
fixtures/
__fixtures__/**/*.md
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,16 @@ The content of the file should follow the below format:

```yaml
validators:
- field: read_team
- field: read-team
script: team
- field: write_team
- field: write-team
script: team
```

| Property | Description |
| -------- | --------------------------------------------------------------- |
| `field` | The `label` attribute of the input in the issue form template |
| `field` | The `id` attribute of the input in the issue form template |
| | If `id` is not provided, the `label` attribute will be used |
| | Must be camel-cased, and all special characters removed |
| | This matches the output format of the `issue-ops/parser` action |
| | E.g. `My Input Name :D` -> `my_input_name` |
Expand Down
28 changes: 28 additions & 0 deletions __fixtures__/example/compiled-success.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# :tada: **New Thing Request Validated**

Your request has been validated! The following details were parsed from your
request.

<!--prettier-ignore-start-->
<!--markdownlint-disable MD034-->

| Key | Value |
| ---------- | ---------- |
| `name` | this-thing |
| `nickname` | thing |
| `color` | ["blue"] |
| `shape` | ["square"] |
| `sounds` | ["re","mi"] |
| `topics` | [] |
| `description` | This is a description.<br><br>It has multiple lines.<br><br>It's pretty cool! |
| `notes` | - Note<br>- Another note<br>- Lots of notes |
| `code` | const thing = new Thing()<br>thing.doThing() |
| `code-string` | thing.toString() |
| `is-thing` | {"selected":["Yes","No"],"unselected":[]} |
| `is-thing-useful` | {"selected":["Sometimes"],"unselected":["Yes","No"]} |
| `read-team` | IssueOps-Demo-Readers |
| `write-team` | IssueOps-Demo-Writers-NotATeam |

<!--prettier-ignore-end-->

Thank you for using IssueOps!
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions __fixtures__/example/parsed-issue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"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", "No"],
"unselected": []
},
"is-thing-useful": {
"selected": ["Sometimes"],
"unselected": ["Yes", "No"]
},
"read-team": "IssueOps-Demo-Readers",
"write-team": "IssueOps-Demo-Writers-NotATeam"
}
90 changes: 90 additions & 0 deletions __fixtures__/example/parsed-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"name": {
"label": "The Name of the Thing",
"type": "input",
"required": true
},
"nickname": {
"label": "The Nickname of the Thing",
"type": "input",
"required": false
},
"color": {
"label": "The Color of the Thing",
"type": "dropdown",
"required": true,
"multiple": false,
"options": [
"blue",
"black",
"green",
"orange",
"purple",
"red",
"white",
"yellow"
]
},
"shape": {
"label": "The Shape of the Thing",
"type": "dropdown",
"required": false,
"multiple": false,
"options": ["circle", "square", "triangle"]
},
"sounds": {
"label": "The Sounds of the Thing",
"type": "dropdown",
"required": true,
"multiple": true,
"options": ["do", "re", "mi", "fa", "so", "la", "ti"]
},
"topics": {
"label": "The Topics About the Thing",
"type": "dropdown",
"required": false,
"multiple": true,
"options": ["cool", "fun", "interesting", "neat"]
},
"description": {
"label": "The Description of the Thing",
"type": "textarea",
"required": true
},
"notes": {
"label": "The Notes About the Thing",
"type": "textarea",
"required": false
},
"code": {
"label": "The Code of the Thing",
"type": "textarea",
"required": true
},
"code-string": {
"label": "The String Method of the Code of the Thing",
"type": "textarea",
"required": false
},
"is-thing": {
"label": "Is the Thing a Thing?",
"type": "checkboxes",
"required": false,
"options": [
{ "label": "Yes", "required": true },
{ "label": "No", "required": false }
]
},
"is-thing-useful": {
"label": "Is the Thing Useful?",
"type": "checkboxes",
"required": false,
"options": [
{ "label": "Yes", "required": false },
{ "label": "Sometimes", "required": false },
{ "label": "No", "required": false }
]
},
"read-team": { "label": "Read Team", "type": "input", "required": true },
"write-team": { "label": "Write Team", "type": "input", "required": true }
}
File renamed without changes.
File renamed without changes.
28 changes: 0 additions & 28 deletions __fixtures__/examples/compiled-success.md

This file was deleted.

65 changes: 65 additions & 0 deletions __fixtures__/no-ids/issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
### 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.

It has multiple lines.

It's pretty cool!

### The Notes About the Thing

- Note
- Another note
- Lots of notes

### The Code of the Thing

const thing = new Thing()
thing.doThing()

### The String Method of the Code of the Thing

thing.toString()

### Is the Thing a Thing?

- [x] Yes
- [ ] No

### Is the Thing Useful?

- [ ] Yes
- [x] Sometimes
- [ ] No

### Read Team

IssueOps-Demo-Readers

### Write Team

IssueOps-Demo-Writers
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"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": {
"selected": ["Yes", "No"],
"unselected": []
"selected": ["Yes"],
"unselected": ["No"]
},
"is_the_thing_useful": {
"selected": ["Sometimes"],
"unselected": ["Yes", "No"]
},
"read_team": "IssueOps-Demo-Readers",
"write_team": "IssueOps-Demo-Writers-NotATeam"
"write_team": "IssueOps-Demo-Writers"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"the_name_of_the_thing": { "type": "input", "required": true },
"the_nickname_of_the_thing": { "type": "input", "required": false },
"the_name_of_the_thing": {
"label": "The Name of the Thing",
"type": "input",
"required": true
},
"the_nickname_of_the_thing": {
"label": "The Nickname of the Thing",
"type": "input",
"required": false
},
"the_color_of_the_thing": {
"label": "The Color of the Thing",
"type": "dropdown",
"required": true,
"multiple": false,
Expand All @@ -17,31 +26,48 @@
]
},
"the_shape_of_the_thing": {
"label": "The Shape of the Thing",
"type": "dropdown",
"required": false,
"multiple": false,
"options": ["circle", "square", "triangle"]
},
"the_sounds_of_the_thing": {
"label": "The Sounds of the Thing",
"type": "dropdown",
"required": true,
"multiple": true,
"options": ["do", "re", "mi", "fa", "so", "la", "ti"]
},
"the_topics_about_the_thing": {
"label": "The Topics About the Thing",
"type": "dropdown",
"required": false,
"multiple": true,
"options": ["cool", "fun", "interesting", "neat"]
},
"the_description_of_the_thing": { "type": "textarea", "required": true },
"the_notes_about_the_thing": { "type": "textarea", "required": false },
"the_code_of_the_thing": { "type": "textarea", "required": true },
"the_description_of_the_thing": {
"label": "The Description of the Thing",
"type": "textarea",
"required": true
},
"the_notes_about_the_thing": {
"label": "The Notes About the Thing",
"type": "textarea",
"required": false
},
"the_code_of_the_thing": {
"label": "The Code of the Thing",
"type": "textarea",
"required": true
},
"the_string_method_of_the_code_of_the_thing": {
"label": "The String Method of the Code of the Thing",
"type": "textarea",
"required": false
},
"is_the_thing_a_thing": {
"label": "Is the Thing a Thing?",
"type": "checkboxes",
"required": false,
"options": [
Expand All @@ -50,6 +76,7 @@
]
},
"is_the_thing_useful": {
"label": "Is the Thing Useful?",
"type": "checkboxes",
"required": false,
"options": [
Expand All @@ -58,6 +85,6 @@
{ "label": "No", "required": false }
]
},
"read_team": { "type": "input", "required": true },
"write_team": { "type": "input", "required": true }
"read_team": { "label": "Read Team", "type": "input", "required": true },
"write_team": { "label": "Write Team", "type": "input", "required": true }
}
Loading

0 comments on commit 3d1d383

Please sign in to comment.