diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 980b1e9..70aff70 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -17,7 +17,7 @@ categories: - title: 'Maintenance' label: 'maintenance' - title: 'Documentation' - label: 'docs' + label: 'documentation' - title: 'Other changes' - title: 'Dependency Updates' label: 'dependencies' @@ -34,7 +34,7 @@ version-resolver: labels: - 'bug' - 'maintenance' - - 'docs' + - 'documentation' - 'dependencies' - 'security' diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml index 919be4b..ef741eb 100644 --- a/.github/workflows/pr-auto-label.yml +++ b/.github/workflows/pr-auto-label.yml @@ -1,4 +1,4 @@ -name: 'Auto Label by Title' +name: "Auto Label by Title" on: pull_request: @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest # 添加权限配置 permissions: - issues: write # 或者 contents: write + issues: write # 或者 contents: write pull-requests: write steps: - name: Label PR based on title keywords @@ -37,13 +37,20 @@ jobs: 'dependabot': 'dependencies', 'upgrade': 'dependencies', 'security': 'security', - 'ci':'ci' + 'ci': 'ci' }; - // 检查标题是否包含关键词 - for (const [keyword, label] of Object.entries(keywordMap)) { - if (title.includes(keyword)) { - labelsToAdd.add(label); + // 提取标题的第一个单词(冒号前的部分) + const firstPart = title.split(':')[0].trim(); + const words = firstPart.split(/\s+/); // 分割成单词数组 + + // 检查第一个单词或前缀是否匹配关键词 + for (const word of words) { + const normalizedWord = word.toLowerCase().replace(/^[\W_]+|[\W_]+$/g, ''); + + if (keywordMap.hasOwnProperty(normalizedWord)) { + labelsToAdd.add(keywordMap[normalizedWord]); + break; // 找到第一个匹配就停止 } } diff --git a/docs/source/development/git.md b/docs/source/development/git.md index dfa0285..3afc754 100644 --- a/docs/source/development/git.md +++ b/docs/source/development/git.md @@ -227,6 +227,7 @@ git log --stat # 查看所有提交记录的修改文件信息 git log -p file # 查看某个文件的修改历史 git log COMMIT1..COMMIT2 -- file # 查看某个文件从 COMMIT1 到COMMIT2 所有的修改情况(概略信息) git log COMMIT1..COMMIT2 -p file # 查看某个文件从 COMMIT1 到COMMIT2 所有的修改情况(详细信息) +git log -n 4 --pretty=format:"%s" # 查看最近4条提交记录并只显示提交信息 ``` - 合并分支(变基) @@ -555,10 +556,11 @@ oco config set OCO_AI_PROVIDER='azure' OCO_MODEL='gpt-4o' oco config set OCO_API_KEY=xxx ``` -3. 【可选】关闭自动 push +3. 【可选配置】 ```bash -oco config set OCO_GITPUSH=false +oco config set OCO_GITPUSH=false # 关闭自动 push +oco config set OCO_ONE_LINE_COMMIT=true # 单行 commit ``` 4. 使用 oco 命令生成 commit