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

support empty strings for event_type_suffix in json config #187

Open
sireeshavnv opened this issue Feb 2, 2023 · 3 comments
Open

support empty strings for event_type_suffix in json config #187

sireeshavnv opened this issue Feb 2, 2023 · 3 comments

Comments

@sireeshavnv
Copy link

sireeshavnv commented Feb 2, 2023

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"
}
@peter-evans
Copy link
Owner

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.

@sireeshavnv
Copy link
Author

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?

@peter-evans
Copy link
Owner

@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.

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

No branches or pull requests

2 participants