Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
feat(github): add checking for creating pull request titles (#1233)
DavdGaod8aa491a9667
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.mdindex 1113a9724..9567ca028 100644--- a/.github/PULL_REQUEST_TEMPLATE.md+++ b/.github/PULL_REQUEST_TEMPLATE.md@@ -1,3 +1,11 @@+## PR Title Format++Please ensure your PR title follows the Conventional Commits format:+- Format: `<type>(<scope>): <description>`+- Example: `feat(memory): add redis cache support`+- Allowed types: `feat`, `fix`, `docs`, `ci`, `refactor`, `test`, `chore`, `perf`, `style`, `build`, `revert`+- Description should start with a lowercase letter+## AgentScope Version[The version of AgentScope you are working on, e.g. `import agentscope; print(agentscope.__version__)`]diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.ymlnew file mode 100644index 000000000..e0f7f40e4--- /dev/null+++ b/.github/workflows/pr-title-check.yml@@ -0,0 +1,49 @@+name: PR Title Check++on:+ pull_request:+ branches:+ - main+ types: [opened, edited, synchronize, reopened]++jobs:+ check-pr-title:+ runs-on: ubuntu-latest+ steps:+ - name: Check PR Title Format+ uses: amannn/[email protected]+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ # Configure allowed types based on your requirements+ types: |+ feat+ fix+ docs+ ci+ refactor+ test+ chore+ perf+ style+ build+ revert+ # Require a scope (the part in parentheses)+ requireScope: false+ # Scope pattern: only lowercase letters, numbers, hyphens, and underscores allowed+ scopePattern: ^[a-z0-9_-]+$+ scopePatternError: |+ The scope (text in parentheses) must contain only lowercase letters, numbers, hyphens, and underscores.+ Example: "feat(memory): add redis cache support"+ Invalid: "feat(Memory): ..." or "feat(MEMORY): ..."+ # Subject (description) must not be empty and must be lowercase+ subjectPattern: ^(?![A-Z]).+$+ subjectPatternError: |+ The subject (description after colon) must start with a lowercase letter.+ Example: "feat(memory): add redis cache support"+ # Validate the entire PR title against the Conventional Commits spec+ validateSingleCommit: false+ # Ignore merge commits+ ignoreLabels: |+ ignore-semantic-pull-request+diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex a71682226..519299fd3 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -54,7 +54,42 @@ refactor(formatter): simplify message formatting logicci(models): add unit tests for OpenAI integration```-### 3. Code Development Guidelines+### 3. Pull Request Title Format++Pull request titles must follow the same [Conventional Commits](https://www.conventionalcommits.org/) specification:++**Format:**+```+<type>(<scope>): <description>+```++**Requirements:**+- The title must start with one of the allowed types: `feat`, `fix`, `docs`, `ci`, `refactor`, `test`, `chore`, `perf`, `style`, `build`, `revert`+- Scope is optional but recommended+- **Scope must be lowercase** - only lowercase letters, numbers, hyphens (`-`), and underscores (`_`) are allowed+- Description should start with a lowercase letter+- Keep the title concise and descriptive++**Examples:**+```+✅ Valid:+feat(memory): add redis cache support+fix(agent): resolve memory leak in ReActAgent+docs(tutorial): update installation guide+ci(workflow): add PR title validation+refactor(my-feature): simplify logic++❌ Invalid:+feat(Memory): add cache # Scope must be lowercase+feat(MEMORY): add cache # Scope must be lowercase+feat(MyFeature): add feature # Scope must be lowercase+```++**Automated Validation:**+- PR titles targeting the `main` branch are automatically validated by GitHub Actions+- PRs with invalid titles will be blocked until the title is corrected++### 4. Code Development Guidelines#### a. Pre-commit Checksdiff --git a/CONTRIBUTING_zh.md b/CONTRIBUTING_zh.mdindex 01d42d6b0..59ac4e397 100644--- a/CONTRIBUTING_zh.md+++ b/CONTRIBUTING_zh.md@@ -52,13 +52,48 @@ refactor(formatter): simplify message formatting logicci(models): add unit tests for OpenAI integration```-### 3. 代码开发指南+### 3. Pull Request 标题格式++Pull Request 标题必须遵循相同的 [Conventional Commits](https://www.conventionalcommits.org/) 规范:++**格式:**+```+<type>(<scope>): <description>+```++**要求:**+- 标题必须以允许的类型之一开头:`feat`、`fix`、`docs`、`ci`、`refactor`、`test`、`chore`、`perf`、`style`、`build`、`revert`+- Scope 是可选的但建议添加+- **Scope 必须是小写** - 只允许小写字母、数字、连字符(`-`)和下划线(`_`)+- 描述应以小写字母开头+- 保持标题简洁且具有描述性++**示例:**+```+✅ 有效:+feat(memory): add redis cache support+fix(agent): resolve memory leak in ReActAgent+docs(tutorial): update installation guide+ci(workflow): add PR title validation+refactor(my-feature): simplify logic++❌ 无效:+feat(Memory): add cache # Scope 必须是小写+feat(MEMORY): add cache # Scope 必须是小写+feat(MyFeature): add feature # Scope 必须是小写+```++**自动化验证:**+- 针对 `main` 分支的 PR 标题会通过 GitHub Actions 自动验证+- 标题无效的 PR 将被阻止,直到标题被修正++### 4. 代码开发指南#### a. 提交前检查在提交代码之前,请运行 pre-commit 钩子以确保代码质量和一致性:-**安装:**+```bashpip install pre-commitpre-commit install