mirror of
https://github.com/tiennm99/ghglance.git
synced 2026-10-11 03:13:20 +00:00
The per-theme gallery pages embedded 15 SVGs and skipped records.svg, which the render step has produced since the card landed, while the index claimed every card was shown. Pair records with streak to match the profile README layout at tiennm99/tiennm99. Pass -include-org-repos so the gallery reflects repos under the author's orgs.
119 lines
4.0 KiB
YAML
119 lines
4.0 KiB
YAML
name: Demo
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- "demo/**"
|
|
- "**.md"
|
|
- "LICENSE"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
concurrency:
|
|
group: demo
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
generate:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: "1.26"
|
|
cache: true
|
|
|
|
- name: Build ghstats
|
|
run: go build -trimpath -ldflags="-s -w" -o ghstats .
|
|
|
|
- name: Render every card for every theme
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GHSTATS_TOKEN }}
|
|
run: |
|
|
rm -rf demo
|
|
mkdir -p demo
|
|
./ghstats \
|
|
-user "${{ github.repository_owner }}" \
|
|
-themes all \
|
|
-tz Asia/Saigon \
|
|
-start-of-week monday \
|
|
-include-org-repos \
|
|
-out demo
|
|
|
|
- name: Write demo READMEs (index + per-theme)
|
|
env:
|
|
OWNER: ${{ github.repository_owner }}
|
|
REPO: ${{ github.repository }}
|
|
run: |
|
|
themes=$(./ghstats -list-themes)
|
|
|
|
# Lightweight index so readers don't have to load ~975 images at once.
|
|
{
|
|
echo "# ghstats demo gallery"
|
|
echo
|
|
echo "Every card rendered for [\`$OWNER\`](https://github.com/$OWNER) in every supported theme. Click a theme to open its gallery page — each page embeds 16 SVGs, so only the theme you're reviewing is fetched."
|
|
echo
|
|
echo "Auto-generated by [\`.github/workflows/demo.yml\`](../.github/workflows/demo.yml) on each push to \`main\`. Do not edit by hand."
|
|
echo
|
|
echo "## Themes"
|
|
echo
|
|
for theme in $themes; do
|
|
dir="demo/$theme"
|
|
[ -d "$dir" ] || continue
|
|
echo "- [\`$theme\`](./$theme/README.md)"
|
|
done
|
|
} > demo/README.md
|
|
|
|
# Per-theme page mirrors the author profile README table layout at
|
|
# tiennm99/tiennm99 — singletons stacked two-per-row, then the four
|
|
# last-year/all-time pairs sit in consecutive rows under a shared
|
|
# header.
|
|
for theme in $themes; do
|
|
dir="demo/$theme"
|
|
[ -d "$dir" ] || continue
|
|
out="$dir/README.md"
|
|
cell() {
|
|
local name="$1"
|
|
printf '<td><img src="./%s.svg" alt="%s" /></td>' "$name" "$name"
|
|
}
|
|
row_pair() {
|
|
printf '<tr>'
|
|
cell "$1"
|
|
cell "$2"
|
|
printf '</tr>\n'
|
|
}
|
|
{
|
|
printf '# ghstats — %s\n\n' "$theme"
|
|
printf '[← back to index](../README.md)\n\n'
|
|
printf 'Rendered for [`%s`](https://github.com/%s). 16 SVGs laid out to ' "$OWNER" "$OWNER"
|
|
printf 'match the author profile README table.\n\n'
|
|
printf '<div align="center">\n\n<table>\n'
|
|
row_pair profile-details stats
|
|
row_pair repos-per-language top-starred-repos
|
|
row_pair contributions-by-year contributions-heatmap
|
|
row_pair records streak
|
|
printf '<tr><th>Last year</th><th>All time</th></tr>\n'
|
|
row_pair most-commit-language most-commit-language-all-time
|
|
row_pair contributions contributions-all-time
|
|
row_pair productive-weekday productive-weekday-all-time
|
|
row_pair productive-time productive-time-all-time
|
|
printf '</table>\n\n</div>\n'
|
|
} > "$out"
|
|
done
|
|
|
|
- name: Commit demo back to main
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add demo
|
|
if git diff --cached --quiet; then
|
|
echo "No demo changes to commit."
|
|
exit 0
|
|
fi
|
|
git commit -m "chore(demo): regenerate gallery"
|
|
git push origin HEAD:${{ github.ref_name }}
|