From f0db6dbbd143e8f036cce26be68da6f651168086 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Thu, 22 Oct 2026 20:44:21 +0000 Subject: [PATCH] ci: do not leave the token in .git/config after checkout Commit Check runs commit-check-action and the shared pre-commit workflow runs third-party hooks, and neither needs authenticated git. Every other repository's workflows already check out this way. --- .github/workflows/commit-check.yml | 2 ++ .github/workflows/pre-commit.yml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 90332a2..9706813 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -16,6 +16,8 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 # Required for merge-base checks + # Nothing after checkout needs authenticated git. + persist-credentials: false - uses: commit-check/commit-check-action@bcbadb3fec596872bcae51074d8fdbea15c02ba5 # v2.18.0 with: message: true diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 309a2eb..981fb3b 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -20,6 +20,10 @@ jobs: contents: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + # The hooks are other people's code, and none of them needs + # authenticated git: leave the token out of .git/config. + persist-credentials: false - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 id: python-setup with: