fix: add repository parameter to checkout steps for fork PR compatibi…#795
Conversation
…lity for cppcheck.yml This amends 10499fb Log:
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the cppcheck GitHub Actions workflow checkout step to support forked pull requests by upgrading the checkout action and specifying repository and safety options. Sequence diagram for updated cppcheck workflow checkout behaviorsequenceDiagram
participant GitHub
participant cppcheck_workflow
participant actions_checkout_v7
participant action_cppcheck
GitHub->>cppcheck_workflow: trigger pull_request
cppcheck_workflow->>actions_checkout_v7: uses actions/checkout@v7
actions_checkout_v7-->>actions_checkout_v7: ref = github.event.pull_request.head.sha
actions_checkout_v7-->>actions_checkout_v7: repository = github.event.pull_request.head.repo.full_name
actions_checkout_v7-->>actions_checkout_v7: allow-unsafe-pr-checkout = true
actions_checkout_v7-->>cppcheck_workflow: workspace prepared from PR head
cppcheck_workflow->>action_cppcheck: uses linuxdeepin/action-cppcheck@main
action_cppcheck-->>GitHub: report cppcheck results
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Switching to
actions/checkout@v7may break if that tag doesn’t exist or changes behavior; consider pinning to a known released major version or a specific commit for stability. - Enabling
allow-unsafe-pr-checkout: trueintroduces additional risk for untrusted fork PRs; it would be good to explicitly justify this in the workflow or scope it to trusted events only.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Switching to `actions/checkout@v7` may break if that tag doesn’t exist or changes behavior; consider pinning to a known released major version or a specific commit for stability.
- Enabling `allow-unsafe-pr-checkout: true` introduces additional risk for untrusted fork PRs; it would be good to explicitly justify this in the workflow or scope it to trusted events only.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, zccrs 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★ 总体评分:40分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 diff --git a/workflow-templates/cppcheck.yml b/workflow-templates/cppcheck.yml
index f41da53e7..7915f23a7 100644
--- a/workflow-templates/cppcheck.yml
+++ b/workflow-templates/cppcheck.yml
@@ -14,9 +14,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: export
- - uses: actions/checkout@v4
+ # 注意:开启 allow-unsafe-pr-checkout 以支持 Fork 仓库 PR 检查
+ # 请确保后续步骤不执行不可信代码
+ - uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
+ repository: ${{ github.event.pull_request.head.repo.full_name }}
+ allow-unsafe-pr-checkout: true
persist-credentials: false
- uses: linuxdeepin/action-cppcheck@main
with: |
|
@BLumia: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
…lity for cppcheck.yml
This amends 10499fb
Log:
Summary by Sourcery
CI: