feat(action): do not require json formatted list, but comme separated list

This commit is contained in:
Bertrand Lanson 2024-02-28 19:01:46 +01:00
parent a6575ebcdb
commit 794ca36d86
2 changed files with 6 additions and 5 deletions

View File

@ -9,7 +9,7 @@ The following parameters can be used as `step.with` keys:
| Name | Type | Default | Required |Description |
| ------------------ | ------ | ------- |--------- |--------------------------------- |
| `versions ` | String | | yes | Json Formatted List as a String |
| `versions ` | String | | yes | comma separated list of versions |
## Example usage
@ -23,5 +23,5 @@ jobs:
- name: Generate docker build matrix
uses: ednz-cloud/docker-matrix-generator@v1
with:
versions: '["2.2.8","2.2.7","2.2.4","2.2.3","2.1.5","2.1.4","2.1.3","2.1.2","2.1.1","2.1.0","2.0.20","2.0.19","2.0.18","2.0.17","2.0.16","2.0.15","2.0.14","2.0.13"]'
versions: 2.2.8, 2.2.7, 2.2.4, 2.2.3
```

View File

@ -48,10 +48,11 @@ def get_latest_versions(versions: List[str]) -> List[Dict[str, any]]:
def main():
all_versions_str = os.environ.get("VERSION_LIST", "")
print(all_versions_str)
all_versions = json.loads(all_versions_str)
all_versions_list = [
version.strip() for version in all_versions_str.split(",") if version.strip()
]
version_objects = get_latest_versions(all_versions)
version_objects = get_latest_versions(all_versions_list)
value = json.dumps(version_objects)