diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..cfcd892 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,28 @@ +name: Validate + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Check JavaScript syntax + run: node --check app.js + + - name: Run automated tests + run: node --test todo-store.test.mjs diff --git a/AGENTS.md b/AGENTS.md index b1232ec..ac51306 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -36,3 +36,4 @@ python3 -m http.server 8000 - 提交前先运行验证命令并审查 diff。 - 提交信息使用 Conventional Commits 风格,例如 `feat: add todo filter`。 - 推送和创建 Pull Request 仅在任务明确要求时执行。 +- GitHub Actions 工作流位于 `.github/workflows/validate.yml`;修改验证命令时同步更新该文件。 diff --git a/README.md b/README.md index da85630..110e1da 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,7 @@ node --test todo-store.test.mjs ``` 测试覆盖新增待办、筛选、切换完成状态、删除和已保存数据的规范化处理。 + +## 持续集成 + +GitHub Actions 会在推送到 `main` 和每个 Pull Request 上自动运行 JavaScript 语法检查与自动化测试。