From cbbcf8e8bdd1560b3d0c73e47abd36eb5d8c6f23 Mon Sep 17 00:00:00 2001 From: Andrey Avtomonov Date: Sat, 30 May 2026 17:44:27 +0200 Subject: [PATCH] ci: normalize star-history.svg trailing newline (#241) The star-history refresh workflow committed the API's SVG verbatim, but the response has no trailing newline. Because the refresh commit uses [skip ci], the file never ran end-of-file-fixer at commit time, so pre-commit's `--all-files` run failed end-of-file-fixer on every open PR (e.g. #240), even PRs that never touched the file. Normalize the downloaded SVG to exactly one trailing newline in the workflow (idempotent, so the "unchanged" guard still works), and fix the currently committed file so open PRs go green now. --- .github/workflows/star-history.yml | 9 ++++++++- assets/star-history.svg | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/star-history.yml b/.github/workflows/star-history.yml index e67a0517..b7d90c43 100644 --- a/.github/workflows/star-history.yml +++ b/.github/workflows/star-history.yml @@ -48,7 +48,14 @@ jobs: echo "Downloaded SVG is suspiciously small; aborting." >&2 exit 1 fi - mv assets/star-history.svg.new assets/star-history.svg + # The star-history API returns the SVG without a trailing newline, + # which end-of-file-fixer rewrites whenever pre-commit runs + # --all-files on a PR. Because the refresh commit below uses [skip ci], + # the hook never runs against it here, so an un-normalized file + # silently breaks the pre-commit check on every open PR. Normalize to + # exactly one trailing newline before committing. + printf '%s\n' "$(cat assets/star-history.svg.new)" > assets/star-history.svg + rm -f assets/star-history.svg.new - name: Commit if changed run: | diff --git a/assets/star-history.svg b/assets/star-history.svg index 246ba5a0..3f6c4a04 100644 --- a/assets/star-history.svg +++ b/assets/star-history.svg @@ -1 +1 @@ -star-history.comMay 17May 24 100200300400kaelio/ktxStar HistoryDateGitHub Stars \ No newline at end of file +star-history.comMay 17May 24 100200300400kaelio/ktxStar HistoryDateGitHub Stars