mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-05 08:14:33 +00:00
22 lines
677 B
JavaScript
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};
|