mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 03:01:21 +02:00
The PAT-token swap didn't fix the gh-pages fetch — same opaque "exit code 1" from actions/checkout@v4 on both attempts of the retry loop, with no underlying git stderr surfaced. Likely the wildcard-refspec + shallow fetch pattern v4 uses combined with something at the runner side, but the action's swallowed errors make it untriagable from logs. Replacing the gh-pages checkout with `git clone --branch gh-pages --depth 1` using the same PAT, embedded in the URL. Direct, explicit, and if anything goes wrong the real git error reaches the log instead of "exit code 1". The recorded remote keeps the PAT, so the later `git push` reuses it — no separate auth setup needed. Identity config (user.name / user.email) moved into the clone step so it lives on the freshly cloned repo; dropped the now-duplicate config calls from commit-and-push. Source checkout still uses actions/checkout@v4 since it never had a problem (the default ref is the workflow's own commit, no wildcard refspec required).
67 lines
2.2 KiB
YAML
67 lines
2.2 KiB
YAML
name: GitHub Repo Stats
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 23 * * *"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
repo-stats:
|
|
name: repo-stats
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: run-ghrs
|
|
uses: jgehrcke/github-repo-stats@v1.4.2
|
|
with:
|
|
repository: maziggy/bambuddy
|
|
ghtoken: ${{ secrets.GHRS_GITHUB_API_TOKEN }}
|
|
ghpagesprefix: https://maziggy.github.io/bambuddy
|
|
|
|
# Inject ghcr.io container-download stats (cumulative + 30-day
|
|
# sparkline merged into a sidecar CSV so the chart grows beyond
|
|
# the 30-day window GHCR exposes). Runs after jgehrcke regenerates
|
|
# report.html on gh-pages.
|
|
- name: checkout-source
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: source
|
|
|
|
# actions/checkout@v4 was hiding the underlying git stderr behind
|
|
# an opaque "exit code 1" even with the same PAT jgehrcke writes
|
|
# gh-pages with. Direct git clone surfaces the real error if
|
|
# anything goes wrong and avoids the wildcard-refspec dance
|
|
# actions/checkout does for fetch-depth=1.
|
|
- name: checkout-gh-pages
|
|
env:
|
|
GH_PAT: ${{ secrets.GHRS_GITHUB_API_TOKEN }}
|
|
run: |
|
|
git clone --branch gh-pages --depth 1 \
|
|
"https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}.git" \
|
|
gh-pages
|
|
cd gh-pages
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: inject-ghcr-pulls
|
|
run: |
|
|
python3 source/.github/scripts/ghcr_inject.py \
|
|
--report gh-pages/maziggy/bambuddy/latest-report/report.html \
|
|
--csv gh-pages/maziggy/bambuddy/ghcr-pulls.csv \
|
|
--owner maziggy \
|
|
--pkg bambuddy
|
|
|
|
- name: commit-and-push
|
|
working-directory: gh-pages
|
|
run: |
|
|
if [ -z "$(git status --porcelain)" ]; then
|
|
echo "no changes — skipping commit"
|
|
exit 0
|
|
fi
|
|
git add maziggy/bambuddy/latest-report/report.html \
|
|
maziggy/bambuddy/ghcr-pulls.csv
|
|
git commit -m "ghcr-pulls: refresh container downloads chart"
|
|
git push
|