Przeglądaj źródła

ci(repo-stats): swap actions/checkout for direct git clone on gh-pages

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).
maziggy 2 miesięcy temu
rodzic
commit
e092c1ea6e
1 zmienionych plików z 14 dodań i 12 usunięć
  1. 14 12
      .github/workflows/repo-stats.yml

+ 14 - 12
.github/workflows/repo-stats.yml

@@ -29,17 +29,21 @@ jobs:
         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
-        uses: actions/checkout@v4
-        with:
-          ref: gh-pages
-          path: gh-pages
-          # Same PAT jgehrcke writes gh-pages with — keeps the auth
-          # chain uniform and avoids the default GITHUB_TOKEN being
-          # rejected on fetch (root cause of the earlier "exit code 1"
-          # with no surfaced git stderr).
-          token: ${{ secrets.GHRS_GITHUB_API_TOKEN }}
-          fetch-depth: 1
+        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: |
@@ -56,8 +60,6 @@ jobs:
             echo "no changes — skipping commit"
             exit 0
           fi
-          git config user.name  "github-actions[bot]"
-          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
           git add maziggy/bambuddy/latest-report/report.html \
                   maziggy/bambuddy/ghcr-pulls.csv
           git commit -m "ghcr-pulls: refresh container downloads chart"