-
Notifications
You must be signed in to change notification settings - Fork 109
feat: add zccrs' spdx-checker for checking copyright year #777
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
base: master
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review这段代码是向 GitHub Actions 工作流中添加了一个新的 Job,用于检查源代码文件的 SPDX 版权声明。整体逻辑清晰,使用了社区现成的 Action 工具。 以下是对该代码的审查意见,分为语法逻辑、代码质量、代码性能和代码安全四个方面: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进后的代码示例结合以上建议,改进后的代码片段如下: Check-SPDX-Copyright:
runs-on: ubuntu-latest
# 显式设置最小权限
permissions:
contents: read
# 如果希望在其他检查通过后再运行,取消下面的注释并根据需要修改依赖的 Job 名称
# needs: [job_name_1, job_name_2]
steps:
- uses: actions/checkout@v5
with:
# 确保只在 PR 上下文中有效,否则可能需要处理非 PR 的情况
ref: ${{ github.event.pull_request.head.sha }}
- uses: zccrs/github-actions-spdx-checker@v1 # 建议替换为具体的 commit SHA 以提高安全性
with:
base: origin/master
include: '*.py,*.js,*.jsx,*.tsx,*.java,*.cpp,*.c,*.h,*.hpp,*.go,*.rs,*.rb,*.php,*.sh,*.xml,*.yaml,*.yml,*.qml,CMakeLists.txt,Makefile'
exclude: 'vendor/**,node_modules/**'
# 建议将持有者名称提取为变量,方便统一管理
holder: '*UnionTech*'总结这段代码逻辑基本正确,能够实现检查版权的目的。主要的改进点在于安全性(锁定第三方 Action 版本、限制权限)和健壮性(明确触发条件和依赖关系)。 |
| - uses: actions/checkout@v5 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| - uses: zccrs/github-actions-spdx-checker@v1 |
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.
Note to self:需等待 zccrs/github-actions-spdx-checker 补充 v1 tag,或转用 @main
BLumia
left a comment
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.
No description provided.