mergeable
mergeable copied to clipboard
Tool assumes every event has an action
At multiple locations in the code base the tool assumes that every event has an action property in its payload (see example).
There a number of events which do not have an action, for example push, and status (which has a useful state property in the payload which would be useful to filter with when calculating supported events).
Proposed Solution
- Add a module for calculating the full event name.
- Refactor tool to use a function from the module wherever we construct the full event name using template strings.
- Modify this function to use
payload.actionwhere available,payload.stateforstatusevents, and nothing at all forpush.
@abid-mujtaba that's a great observation, do you have any specific use case where this might be useful? I understand that it'll be cleaner but i was also wondering if there are specific use cases that this opens up.
When I was developing PR #602 I realized that the user must always target status.* and cannot target specific status states such as status.success because status events do not have action in the payload (but state instead). Because of this the baseRef validator will be triggered for all status events even though it is really only useful for success status events.