diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index c415be7..cf900ef 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -14,4 +14,4 @@ jobs: steps: - uses: actions/checkout@v4 - name: Validate note files - run: python -c "from pathlib import Path; notes=list(Path('.').rglob('*.md')); assert len(notes)>=2 and all(p.read_text(encoding='utf-8').strip() for p in notes)" + run: python scripts/validate_notes.py diff --git "a/01-basics/01-\345\217\230\351\207\217\345\222\214\346\225\260\346\215\256\347\261\273\345\236\213.md" "b/01-basics/01-\345\217\230\351\207\217\345\222\214\346\225\260\346\215\256\347\261\273\345\236\213.md" index b883ea4..f8d38ca 100644 --- "a/01-basics/01-\345\217\230\351\207\217\345\222\214\346\225\260\346\215\256\347\261\273\345\236\213.md" +++ "b/01-basics/01-\345\217\230\351\207\217\345\222\214\346\225\260\346\215\256\347\261\273\345\236\213.md" @@ -209,8 +209,9 @@ print("很高兴认识你!") # 获取出生年份 birth_year = int(input("请输入你的出生年份:")) -# 计算年龄 -current_year = 2026 +# 使用当前年份计算年龄,避免示例过期 +from datetime import date +current_year = date.today().year age = current_year - birth_year # 输出 diff --git a/README.md b/README.md index 8c55cb0..24c6349 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,14 @@ python-notes/ - **GitHub:** [@DorianChn](https://github.com/DorianChn) - **Email:** 3671276527@qq.com +## ✅ 本地验证 + +```bash +python scripts/validate_notes.py +``` + +该检查不需要第三方依赖,会验证笔记非空并检查仓库内的相对链接。 + ---