Skip to content

Commit a8ad4c5

Browse files
kiyotisclaude
andauthored
fix: add fetch-depth: 0 to collect-metrics workflow (#207)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 993f34d commit a8ad4c5

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/collect-metrics.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
contents: write
1414
steps:
1515
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # full history needed for git log origin/main (first commit date)
1618
- name: Collect metrics
1719
env:
1820
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

tools/metrics/collect.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ def get_weeks_since_first_commit(repo_root: str) -> list[datetime]:
162162
while monday < current_monday:
163163
weeks.append(monday)
164164
monday += timedelta(weeks=1)
165-
return weeks
165+
if weeks:
166+
return weeks
167+
# weeks is empty when first commit is in the current week — fall through to fallback
166168
# Fallback: last 8 weeks
167169
now = datetime.now(tz=timezone.utc)
168170
current_monday = iso_week_monday(now)

0 commit comments

Comments
 (0)