website/layouts/shortcodes/github.html (14 lines of code) (raw):
<a id="github-counter" class="btn btn-lg btn-dark font-weight-bold" href="https://github.com/aws/karpenter">
<i class="fab fa-github"></i>
GitHub
</a>
<script>
url = "https://api.github.com/repos/aws/karpenter-provider-aws"
fetch(url).then(function(response) {
return response.json();
}).then(function(data) {
stars = data.stargazers_count;
var element = document.getElementById("github-counter");
element.innerHTML = `<i class="fab fa-github"></i> Stars on Github: ${stars}`;
})
</script>