Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to template field ID for parsed issue body key #81

Merged
merged 4 commits into from
Aug 29, 2024

Conversation

ncalteen
Copy link
Contributor

By default, when an issue body is parsed, the action will now attempt to match the header in the issue body markdown with the label field of the issue template. If found, it will check if an ID is present for that field. If present, the ID will be used for the property key. Otherwise, the action reverts to the original behavior (slugifying the field label).

E.g. If the field looks like this in the template:

  - type: input
    id: name
    attributes:
      label: The Name of the Thing
      description: The name of the thing you want to create.
      placeholder: this-is-the-thing
    validations:
      required: true

Then the parsed issue body will loo like this:

{
  "name": "Whatever the user-provided value is"
}

Otherwise, if the field looks like this in the template

  - type: input
    attributes:
      label: The Name of the Thing
      description: The name of the thing you want to create.
      placeholder: this-is-the-thing
    validations:
      required: true

Then the parsed issue body JSON will look like:

{
  "the_name_of_the_thing": "Whatever the user-provided value is"
}

By default, when an issue template is parsed, the action will now attempt to match the header in the issue body markdown with the label field of the issue template. If found, it will check if an ID is present for that field. If present, the ID will be used for the property key. Otherwise, the action reverts to the original behavior (slugifying the field label).

E.g. If the field looks like this in the template:

```yaml
  - type: input
    id: name
    attributes:
      label: The Name of the Thing
      description: The name of the thing you want to create.
      placeholder: this-is-the-thing
    validations:
      required: true
```

Then the parsed issue body will loo like this:

```json
{
  "name": "Whatever the user-provided value is"
}
```

Otherwise, if the field looks like this in the template

```yaml
  - type: input
    attributes:
      label: The Name of the Thing
      description: The name of the thing you want to create.
      placeholder: this-is-the-thing
    validations:
      required: true
```

Then the parsed issue body JSON will look like:

```json
{
  "the_name_of_the_thing": "Whatever the user-provided value is"
}
```
@ncalteen ncalteen requested a review from a team as a code owner August 29, 2024 17:27
@ncalteen ncalteen self-assigned this Aug 29, 2024
Copy link

github-actions bot commented Aug 29, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 6 0 0.1s
✅ JSON jsonlint 11 0 0.31s
✅ JSON npm-package-json-lint yes no 0.69s
✅ JSON prettier 11 0 1.53s
✅ JSON v8r 11 0 25.39s
✅ MARKDOWN markdownlint 1 0 0.99s
✅ MARKDOWN markdown-link-check 4 0 2.75s
✅ REPOSITORY checkov yes no 11.72s
✅ REPOSITORY gitleaks yes no 0.97s
✅ REPOSITORY git_diff yes no 0.12s
✅ REPOSITORY grype yes no 13.83s
✅ REPOSITORY secretlint yes no 1.85s
✅ REPOSITORY trivy yes no 6.34s
✅ REPOSITORY trivy-sbom yes no 1.44s
✅ REPOSITORY trufflehog yes no 19.26s
✅ TYPESCRIPT eslint 27 0 11.42s
✅ TYPESCRIPT prettier 27 0 3.18s
✅ YAML prettier 19 0 1.57s
✅ YAML v8r 19 0 39.53s
✅ YAML yamllint 19 0 0.84s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@ncalteen ncalteen merged commit 3d1d383 into main Aug 29, 2024
5 checks passed
@ncalteen ncalteen deleted the ncalteen/fields branch August 29, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant