-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(checkboxes): correctly parse checkboxes when the template is wron…
…g or missing (#71) When the wrong template is provided, then the action will traceback with the error: ```js /home/runner/work/_actions/stefanbuck/github-issue-parser/v3/dist/index.js:105 result[key] = content.concat(value); ^ TypeError: Cannot read properties of undefined (reading 'concat') at /home/runner/work/_actions/stefanbuck/github-issue-parser/v3/dist/index.js:105:33 at Array.forEach (<anonymous>) at toObject (/home/runner/work/_actions/stefanbuck/github-issue-parser/v3/dist/index.js:97:11) at run (/home/runner/work/_actions/stefanbuck/github-issue-parser/v3/dist/index.js:161:12) at 2932 (/home/runner/work/_actions/stefanbuck/github-issue-parser/v3/dist/index.js:184:3) at __nccwpck_require__ (/home/runner/work/_actions/stefanbuck/github-issue-parser/v3/dist/index.js:7097:43) at /home/runner/work/_actions/stefanbuck/github-issue-parser/v3/dist/index.js:7117:37 at Object.<anonymous> (/home/runner/work/_actions/stefanbuck/github-issue-parser/v3/dist/index.js:7120:12) at Module._compile (node:internal/modules/cjs/loader:1241:14) at Module._extensions..js (node:internal/modules/cjs/loader:1295:10) ``` Also, checkboxes aren't represented as an array when the issue-form template is not provided. This commit fixes both issues by correctly parsing checkboxes even when the template is wrong or missing.
- Loading branch information
Showing
6 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"your_contact_details": "me@me.com", | ||
"what_happened": "A bug happened!", | ||
"version": "1.0.0", | ||
"what_browsers_are_you_seeing_the_problem_on": "Chrome, Safari", | ||
"what_else": ["Never give up"], | ||
"and_with_that": ["Hot Dog is a Sandwich", "Another item"], | ||
"checkbox_without_an_id": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
body: | ||
- type: input | ||
id: favorite_dish | ||
attributes: | ||
label: What's your favorite dish? | ||
validations: | ||
required: true | ||
|
||
- type: checkboxes | ||
id: favorite_color | ||
attributes: | ||
label: What's your preferred color? | ||
options: | ||
- label: Red | ||
- label: Green | ||
- label: Blue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
### Your contact details | ||
|
||
me@me.com | ||
|
||
### What happened? | ||
|
||
A bug happened! | ||
|
||
### Version | ||
|
||
1.0.0 | ||
|
||
### What browsers are you seeing the problem on? | ||
|
||
Chrome, Safari | ||
|
||
### What else? | ||
|
||
- [x] Never give up | ||
- [ ] Hot Dog is a Sandwich | ||
|
||
### And with that? | ||
|
||
- [] Never give up | ||
- [X] Hot Dog is a Sandwich | ||
- [x] Another item | ||
|
||
### Checkbox without an id? | ||
|
||
- [ ] IDs are great | ||
- [ ] IDs are bad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { resolve } = require("path"); | ||
const { readFileSync } = require("fs"); | ||
|
||
const issueBodyPath = resolve(__dirname, "issue-body.md"); | ||
|
||
module.exports = readFileSync(issueBodyPath, "utf-8"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters