How to retrieve the content of a yml file under the data folder in a JavaScript method?

I’m trying to create a github pull-request using the Github API.
So I’d like to retrieve the content of a specific yml file that sits in my project → update the content - and then create a commit with the updated content.
I’m having trouble accessing the data/*.yml file via a script tag in my partial file.
Is there any way to pass this file as a parameter?

Thanks!

data/foo.yml

huey: dewey
wibble: wobble

template

<script>
  const d = {{ site.Data.foo }};
  console.log(d.huey);  // dewey
</script>
3 Likes