peter-evans/slash-command-dispatch

support empty strings for event_type_suffix in json config

sireeshavnv opened this issue · 3 comments

The action throws "Error: not found" when event_type_suffix is an empty string in json config input, however it is works fine when event_type_suffix is an empty string in the standard yaml configuration

Example Failed config

{
  "command": "hello-workflow-command",
  "event_type_suffix": "",
  "permission": "none",
  "issue_type": "issue",
  "repository": "peter-evans/slash-command-dispatch-processor",
  "static_args": [
    "repository=${{ github.repository }}",
    "comment-id=${{ github.event.comment.id }}",
    "issue-number=${{ github.event.issue.number }}",
    "actor=${{ github.actor }}"
  ],
  "dispatch_type": "workflow"
}

Hi @sireeshavnv

I can't change the behaviour to allow empty strings because it makes it impossible to set input defaults then. There is no way for the action to know if the input was missing and the default should be applied, or if the user intended it to be an empty string.

Actually, the problem here is that I should have made event-type-suffix a required field. It should not allow empty strings, even if that happens to work.

Please use a non-empty value for event-type-suffix. I'm going to update the action in future to not allow it to be empty.

Thanks for the response. I understand your reason for not allowing empty suffix. As you have indicated, keeping the behaviour consistent is good.

I have an existing workflow in my repo that I do not want to rename to -command.yml, that was reason I was requesting for an empty suffix. An alternative could be to add an optional input to provide the workflow yml file name for a command. What do you think?

@sireeshavnv Sorry, I don't want to add more options than is really necessary here. Is there some reason you can't rename the file? You can choose whatever suffix you like, it doesn't have to be -command.