-
Notifications
You must be signed in to change notification settings - Fork 6
104 lines (87 loc) · 3.18 KB
/
Copy pathvalidate-dates.yml
File metadata and controls
104 lines (87 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Validate Dates
on:
pull_request:
paths:
- 'skills/**/*.md'
- '.github/workflows/validate-dates.yml'
push:
branches:
- main
paths:
- 'skills/**/*.md'
jobs:
check-dates:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Check for future dates
run: |
python3 << 'EOF'
import re
import sys
from pathlib import Path
from datetime import datetime
print("="*60)
print("VALIDATING 'Last Updated' DATES")
print("="*60)
today = datetime.now().date()
print(f"Today's date: {today}\n")
errors = []
checked = 0
skipped = 0
# Meta files that don't need date validation (by name)
SKIP_FILES = {
"MIGRATION_GUIDE.md", "REFACTORING_SUMMARY.md", "_INDEX.md",
"README.md", "ENHANCEMENT_PLAN.md", "ENHANCEMENTS_SUMMARY.md",
"SKILLS_USAGE_GUIDE.md", "CLAUDE.md", "SUMMARY.txt",
"CLAUDE_MD_UPDATES.md", "PLUGIN.md", "MIGRATION.md",
"INDEX.md", "PROJECT_STATUS.md", "QUICK_START.md"
}
# Check skills directory
for skill_file in Path(".").rglob("*.md"):
# Skip archived files
if "_archive" in str(skill_file):
skipped += 1
continue
# Skip commands directory (slash commands don't need date validation)
if "commands" in skill_file.parts:
skipped += 1
continue
# Skip meta files by name
if skill_file.name in SKIP_FILES:
skipped += 1
continue
# Calculate depth (number of slashes after skills/)
# Skip files at depth 3+ (these are reference/foundation/implementation files)
parts = skill_file.parts
if "skills" in parts:
skills_idx = parts.index("skills")
depth = len(parts) - skills_idx - 1
if depth >= 3:
skipped += 1
continue
content = skill_file.read_text(encoding='utf-8')
matches = re.findall(r'\*\*Last Updated\*\*:\s*(\d{4}-\d{2}-\d{2})', content)
for match in matches:
checked += 1
date = datetime.strptime(match, "%Y-%m-%d").date()
if date > today:
errors.append(f"{skill_file}: Future date {match} (today is {today})")
print(f"Checked: {checked} dates")
print(f"Skipped: {skipped} supporting/meta files\n")
if errors:
print("❌ FAILED: Found future dates:\n")
for error in errors:
print(f" • {error}")
print(f"\n{len(errors)} future date(s) found")
print("="*60)
sys.exit(1)
else:
print("✅ SUCCESS: All dates are valid")
print("="*60)
EOF