-
Notifications
You must be signed in to change notification settings - Fork 448
Description
Description:
Instead of requiring every single level of keys below the top level in the configuration file to have a list as a value, restructure to use mappings whenever possible.
In effect, change the config structure so that the following:
some_label:
- any:
- changed-files:
- any-glob-to-any-file:
- pattern1
- pattern2
- all:
- head-branches:
- pattern3
- base-branches:
- pattern4
instead is represented like this:
some_label:
any:
changed-files:
any-glob-to-any-file:
- pattern1
- pattern2
all:
head-branches:
- pattern3
base-branches:
- pattern4
Justification:
The config format used in v4 utilized type based discrimination of the list items for each label in the config to maintain backwards compatibility despite the addition of the all
and any
syntax. I would argue that requiring a list in this case was less than ideal (JS/TS should be able to easily differentiate between an array and an object, and that type of differentiation would have made the config a bit easier to understand logically), but the backwards compatibility aspect was useful because the new config parser still supported the old format.
With v5 though, this habit of making value under each label be a list of objects or strings was kept and further propagated to the new ‘sub’ configuration items, despite the fact that the new config format is not at all backwards compatible with the old formats.
This has a number of distinct disadvantages for end users:
- The resultant config files include excess boilerplate structure that do not contribute anything to the actual meaning of the configuration, opening up significant possibility of confusion on the part of users who are trying to understand (or write) a given configuration.
- This format is at best rather difficult to write an accurate schema for, if not outright impossible depending on how pedantic you want to be. This makes it harder for users to validate the config file before committing it or before merging changes to it, which is particularly significant because the normal usage of this action as a
pull_request_target
hook instead of apull_request
hook means that an invalid config file won’t actually show any errors until after it’s merged, at which point it will fail workflow runs on unrelated PRs.
I also strongly suspect that the code doing the parsing is, in fact, more complex than it would need to be if this proposal were implemented, so this may have long-term benefits for the maintainability of the code.
Are you willing to submit a PR?
Unfortunately not, as I have no background working with TypeScript and recognize that this will probably require some nontrivial changes to the code that parses the config file.