I have a static website that I am deploying with Github Actions. The website consists of 1 HTML file and several .yaml config files. There is a simple javascript function that loads all the .yaml files. However, currently the list of .yaml files is hardcoded. Is there anyway to either:
- Use Github Actions to update the javascript array before deploying the website?
- Use javascript to dynamically create the list based on the files in the config directory?
Directory structure
index.html
config/
|-- first.yaml
|-- second.yaml
|-- ...
index.html
...
<script>
// how can we dynamically create this array?
var files = [
{"name": "first.yaml"},
{"name": "second.yaml"},
...
]
</script>