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 #73

Merged
merged 3 commits into from
Aug 29, 2024
Merged

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 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:

```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 self-assigned this Aug 29, 2024
@ncalteen ncalteen requested a review from a team as a code owner August 29, 2024 16:28
Copy link

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 5 0 0.03s
✅ JSON jsonlint 21 0 0.17s
✅ JSON npm-package-json-lint yes no 0.34s
✅ JSON prettier 21 0 0.87s
✅ JSON v8r 21 0 20.11s
✅ MARKDOWN markdownlint 1 0 0.8s
✅ MARKDOWN markdown-link-check 8 0 1.59s
✅ REPOSITORY checkov yes no 14.03s
✅ REPOSITORY gitleaks yes no 0.52s
✅ REPOSITORY git_diff yes no 0.01s
✅ REPOSITORY grype yes no 13.68s
✅ REPOSITORY secretlint yes no 0.86s
✅ REPOSITORY trivy yes no 65.14s
✅ REPOSITORY trivy-sbom yes no 1.1s
✅ REPOSITORY trufflehog yes no 11.96s
✅ TYPESCRIPT eslint 11 0 8.24s
✅ TYPESCRIPT prettier 11 0 1.93s
✅ YAML prettier 20 0 0.73s
✅ YAML v8r 20 0 29.29s
✅ YAML yamllint 20 0 0.3s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@ncalteen ncalteen merged commit b573c08 into main Aug 29, 2024
5 checks passed
@ncalteen ncalteen deleted the ncalteen/72 branch August 29, 2024 17:22
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