Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy-portfolio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ on:
- "*/*/README.md"
- "CONTRIBUTING.md"
- "THIRD_PARTY_LICENSES.md"
# Hourly rebuild so the GitHub star count on the site stays current.
# Weekly rebuild refreshes the baked-in star count (app.js updates it live).
schedule:
- cron: "17 * * * *"
- cron: "0 12 * * 1"
workflow_dispatch:

permissions: {}
Expand Down
28 changes: 28 additions & 0 deletions site/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@
filter.js (SkillFilter); this file only handles events and rendering.
The buffer always starts with "/" (pre-typed, undeletable); the rest is
typed freely and ranked by SkillFilter.search. */
// Live GitHub star count. The build bakes in a count (build_site.py); this
// refreshes it per visit, cached 10 min per tab to stay under the API's
// 60 requests/hour unauthenticated limit. Any failure keeps the baked count.
(function () {
"use strict";
var KEY = "gh-stars";
function show(n) {
var els = document.querySelectorAll(".gh-stars");
for (var i = 0; i < els.length; i++) {
els[i].textContent = "★ " + n;
els[i].hidden = false;
}
}
try {
var c = JSON.parse(sessionStorage.getItem(KEY) || "null");
if (c && Date.now() - c.t < 600000) return show(c.n);
} catch (e) {}
if (!window.fetch) return;
fetch("https://api.github.com/repos/KrishP147/skills")
.then(function (r) { return r.ok ? r.json() : null; })
.then(function (d) {
if (!d || typeof d.stargazers_count !== "number") return;
show(d.stargazers_count);
try { sessionStorage.setItem(KEY, JSON.stringify({ n: d.stargazers_count, t: Date.now() })); } catch (e) {}
})
.catch(function () {});
})();

(function () {
"use strict";
var F = window.SkillFilter;
Expand Down
Loading