diff --git a/.github/workflows/restricted-paths-guard.yml b/.github/workflows/restricted-paths-guard.yml index 8d7e6eccd4..95f7f8f71c 100644 --- a/.github/workflows/restricted-paths-guard.yml +++ b/.github/workflows/restricted-paths-guard.yml @@ -6,7 +6,8 @@ name: "CI: Restricted Paths Guard" on: # Run on drafts too so maintainers get early awareness on WIP PRs. # Label updates on fork PRs require pull_request_target permissions. - pull_request_target: + # TEMPORARY: Using pull_request for testing; revert to pull_request_target before merge. + pull_request: types: - opened - synchronize @@ -29,6 +30,7 @@ jobs: PR_AUTHOR: ${{ github.event.pull_request.user.login }} PR_NUMBER: ${{ github.event.pull_request.number }} PR_URL: ${{ github.event.pull_request.html_url }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} # Workflow policy inputs REVIEW_LABEL: Needs-Restricted-Paths-Review @@ -113,9 +115,25 @@ jobs: echo '```' } + post_review_label_comment() { + local comment_body + printf -v comment_body '%s\n\n%s\n' \ + "\`$REVIEW_LABEL\` was assigned by \`CI: Restricted Paths Guard\`." \ + "For details, open [this workflow run]($RUN_URL) and click **Summary**." + + if gh api "repos/$REPO/issues/$PR_NUMBER/comments" \ + -f body="$comment_body" >/dev/null; then + COMMENT_ACTION="posted" + else + COMMENT_ACTION="failed (non-fatal)" + echo "::warning::Failed to post PR comment about newly added $REVIEW_LABEL." + fi + } + HAS_TRUSTED_SIGNAL=false LABEL_ACTION="not needed (no restricted paths)" TRUSTED_SIGNALS="(none)" + COMMENT_ACTION="not needed" if [ "$TOUCHES_RESTRICTED_PATHS" = "true" ]; then # Distinguish a legitimate 404 "not a collaborator" response from @@ -149,13 +167,13 @@ jobs: fi case "$COLLABORATOR_PERMISSION" in - admin|maintain|write) + admin|maintain|triage|read) HAS_TRUSTED_SIGNAL=true LABEL_ACTION="not needed (collaborator permission is a trusted signal)" TRUSTED_SIGNALS="collaborator_permission:$COLLABORATOR_PERMISSION" ;; *) - # triage, read, or none: not a trusted signal + # none: not a trusted signal ;; esac fi @@ -189,6 +207,7 @@ jobs: exit 1 else LABEL_ACTION="added" + post_review_label_comment fi elif [ "$LABEL_ALREADY_PRESENT" = "true" ]; then LABEL_ACTION="left in place (manual removal required)" @@ -203,6 +222,7 @@ jobs: echo "- **Restricted paths**: \`cuda_bindings/\`, \`cuda_python/\`" echo "- **Trusted signals**: $TRUSTED_SIGNALS" echo "- **Label action**: $LABEL_ACTION" + echo "- **Comment action**: $COMMENT_ACTION" if [ "$TOUCHES_RESTRICTED_PATHS" = "true" ]; then echo "" write_matching_restricted_paths diff --git a/cuda_bindings/pyproject.toml b/cuda_bindings/pyproject.toml index d72ab7f775..38cec71ed2 100644 --- a/cuda_bindings/pyproject.toml +++ b/cuda_bindings/pyproject.toml @@ -1,5 +1,6 @@ # SPDX-FileCopyrightText: Copyright (c) 2023-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE +# XXX DUMMY CHANGE FOR TESTING restricted-paths-guard.yml - REMOVE BEFORE MERGE XXX [build-system] requires = [ "setuptools>=80.0.0",