Skip to content

Commit 8f6000a

Browse files
committed
ci: use a blobless full-history checkout for pre-commit
check_spdx.py needs commit history to find when each file last changed. Correct the comment: in a shallow clone every file appears to be introduced by the tip commit, so each would be judged against the tip commit's year (not a false pass, as the comment previously claimed). Add filter: blob:none so the job fetches all commits and trees but not historical file contents, which a path-limited git log does not read.
1 parent 6b27ed4 commit 8f6000a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎.github/workflows/pre-commit.yml‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ jobs:
5858

5959
# PR workflows run from the merge revision; check out that same revision
6060
# so their helper scripts and configuration stay in sync.
61-
# Full history is required so that check_spdx.py can call `git log -1`
62-
# to determine when each file was last modified (used for copyright-year
63-
# enforcement). A shallow clone would return no history for files not
64-
# touched in the tip commit, causing false passes on stale years.
61+
# check_spdx.py runs `git log -1 -- <file>` to find the year each file last
62+
# changed (copyright-year enforcement), so it needs the full commit history.
63+
# In a shallow clone every file looks like it was introduced by the tip
64+
# commit, so each would be judged against the tip commit's year.
65+
# blob:none keeps all commits and trees but skips historical file contents,
66+
# which a path-limited `git log` does not read.
6567
- name: Checkout repository
6668
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6769
with:
6870
fetch-depth: 0
71+
filter: blob:none
6972
persist-credentials: false
7073

7174
- name: Set up Python

0 commit comments

Comments
 (0)