-
Notifications
You must be signed in to change notification settings - Fork 2
ci: Add pr.yml #1816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: Add pr.yml #1816
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,30 @@ | ||||||||||||||||||||
checks: | ||||||||||||||||||||
|
||||||||||||||||||||
- check: message | ||||||||||||||||||||
regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)|(Merge).*|(fixup!.*)' | ||||||||||||||||||||
error: "The commit message should be structured as follows:\n\n | ||||||||||||||||||||
<type>[optional scope]: <description>\n | ||||||||||||||||||||
[optional body]\n | ||||||||||||||||||||
[optional footer(s)]\n\n | ||||||||||||||||||||
More details please refer to https://www.conventionalcommits.org" | ||||||||||||||||||||
suggest: please check your commit message whether matches above regex | ||||||||||||||||||||
|
||||||||||||||||||||
- check: branch | ||||||||||||||||||||
regex: ^(bugfix|feature|release|hotfix|task|chore)\/.+|(master)|(main)|(HEAD)|(PR-.+) | ||||||||||||||||||||
error: "Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/ chore/" | ||||||||||||||||||||
suggest: run command `git checkout -b type/branch_name` | ||||||||||||||||||||
|
||||||||||||||||||||
- check: author_name | ||||||||||||||||||||
regex: ^[A-Za-z ,.\'-]+$|.*(\[bot]) | ||||||||||||||||||||
error: The committer name seems invalid | ||||||||||||||||||||
suggest: run command `git config user.name "Your Name"` | ||||||||||||||||||||
|
||||||||||||||||||||
Comment on lines
+17
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 改进作者姓名验证以支持国际化 当前的姓名验证规则过于严格,不支持国际化名称:
建议修改为更包容的正则表达式: - regex: ^[A-Za-z ,.\'-]+$|.*(\[bot])
+ regex: ^[\p{L}\p{M}\p{N} ,.\'-]+$|.*(\[bot]) 注意:此正则表达式使用了 Unicode 属性来匹配所有语言的字母和变音符号。 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||
- check: author_email | ||||||||||||||||||||
regex: ^.+@.+$ | ||||||||||||||||||||
error: The committer email seems invalid | ||||||||||||||||||||
suggest: run command `git config user.email yourname@example.com` | ||||||||||||||||||||
|
||||||||||||||||||||
Comment on lines
+22
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 增强电子邮件地址验证 当前的电子邮件验证规则过于简单,可能允许无效的邮件地址。建议加强验证规则:
建议使用更严格的正则表达式: - regex: ^.+@.+$
+ regex: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||
- check: merge_base | ||||||||||||||||||||
regex: master # it can be master, develop, devel etc based on your project. | ||||||||||||||||||||
error: Current branch is not rebased onto target branch | ||||||||||||||||||||
suggest: please ensure your branch is rebased with the target branch |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Commit Check | ||
|
||
on: | ||
pull_request: | ||
branches: 'master' | ||
|
||
jobs: | ||
commit-check: | ||
runs-on: ubuntu-latest | ||
permissions: # use permissions because of use pr-comments | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit | ||
fetch-depth: 0 # required for merge-base check | ||
- uses: commit-check/commit-check-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.CHANGELOG }} # use GITHUB_TOKEN because of use pr-comments | ||
with: | ||
unknowIfGuestInDream marked this conversation as resolved.
Show resolved
Hide resolved
|
||
message: false | ||
branch: false | ||
author-name: true | ||
author-email: true | ||
commit-signoff: true | ||
merge-base: false | ||
job-summary: true | ||
pr-comments: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
建议移除不必要的 PR- 分支命名支持
根据仓库历史记录分析,当前并未使用 PR- 前缀的分支命名模式。建议简化分支命名规则,移除 PR- 相关配置:
这样的修改可以:
🔗 Analysis chain
验证分支命名规则的合理性
当前的分支命名规则需要进行以下验证:
建议修改正则表达式以限制分支名称中的字符:
Let me gather more information about branch naming patterns in the repository.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 100
Script:
Length of output: 178