Skip to content

Support custom Handlebars helpers in comment templates #202

@nmoa

Description

@nmoa

Summary

I would like to propose support for repository-defined custom Handlebars helpers in validator comment templates.

Problem

issue-ops/validator already supports custom validation scripts, but comment templates are still limited to built-in helpers. Because of that, it is hard to format structured values in repository-specific ways.

For example, if an issue form contains a multiline textarea such as a list of team names, it may be more useful to render that value as a Markdown table in the success comment. That kind of formatting is difficult to do cleanly with only built-in helpers.

Proposal

Allow repositories to define custom Handlebars helpers in .github/validator/config.yml, alongside custom validators.

Example:

validators:
  - field: github_username
    script: username.js
helpers:
  - name: linesToMarkdownTable
    script: lines-to-markdown-table.js

The helper scripts would live in .github/validator/ and be loaded when rendering success.mustache and failure.mustache.

Example Use Case

There is a sample of the expected behavior in nmoa/issueops#8.

In that example, a multiline Teams to Add field is rendered as a Markdown table in the validator comment. That is the kind of output customization I would like to support in issue-ops/validator.

Why This Would Help

  • It would let repositories keep validation logic and comment-formatting logic in the same place.
  • It would make validator comments much more readable for structured inputs.
  • It would avoid forcing repositories to fork the action just to customize comment output.

Compatibility and Safety

I think this can follow the same trust model as custom validators, since both features execute repository-defined scripts from the checked-out workspace.

To keep the behavior predictable, it would also make sense to:

  • keep the feature optional
  • prevent custom helpers from overriding built-in helper names
  • preserve the current behavior when no helpers are configured

Thanks for considering this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions