Files
HugoBlox-kit/modules/wowchemy/assets/js/wowchemy-github.js
T
Geo a042ab6e60 refactor: rename modules
github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5

github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugins-netlify-cms/v1

See #2754
2022-06-28 18:29:39 +01:00

22 lines
677 B
JavaScript

import {hugoEnvironment} from '@params';
/* ---------------------------------------------------------------------------
* GitHub API.
* --------------------------------------------------------------------------- */
function printLatestRelease(selector, repo) {
if (hugoEnvironment === 'production') {
$.getJSON('https://api.github.com/repos/' + repo + '/tags')
.done(function (json) {
let release = json[0];
$(selector).append(' ' + release.name);
})
.fail(function (jqxhr, textStatus, error) {
let err = textStatus + ', ' + error;
console.log('Request Failed: ' + err);
});
}
}
export {printLatestRelease};