Skip to content

Commit bc16d97

Browse files
committed
Revert "CI: label PRs without trusted author signals"
This reverts commit 9dcf7b1.
1 parent c09bb82 commit bc16d97

1 file changed

Lines changed: 23 additions & 98 deletions

File tree

Lines changed: 23 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
name: "CI: Check PR author signals for restricted paths"
4+
name: "CI: Check PR author organization for restricted paths"
55

66
on:
7-
# Label updates on fork PRs require pull_request_target permissions.
8-
# TODO BEFORE MERGING: change to pull_request_target
97
pull_request:
108
types:
119
- opened
@@ -15,33 +13,24 @@ on:
1513

1614
jobs:
1715
check-author-org:
18-
name: PR author signals recorded for restricted paths
16+
name: PR author may modify restricted paths
1917
if: github.repository_owner == 'NVIDIA'
2018
runs-on: ubuntu-latest
2119
permissions:
22-
issues: write
2320
pull-requests: read
2421
steps:
25-
- name: Inspect PR author signals for restricted paths
22+
- name: Check PR author organization for restricted paths
2623
env:
2724
# PR metadata inputs
2825
AUTHOR_ASSOCIATION: ${{ github.event.pull_request.author_association || 'NONE' }}
29-
EXISTING_LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
3026
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
3127
PR_NUMBER: ${{ github.event.pull_request.number }}
3228
PR_URL: ${{ github.event.pull_request.html_url }}
3329

34-
# Workflow policy inputs
35-
PUBLIC_MEMBER_ORG: NVIDIA
36-
REVIEW_LABEL: Check-PR-author-ORG
37-
3830
# API request context/auth
3931
GH_TOKEN: ${{ github.token }}
40-
GITHUB_API_URL: ${{ github.api_url }}
4132
REPO: ${{ github.repository }}
4233
run: |
43-
set -euo pipefail
44-
4534
if ! MATCHING_RESTRICTED_PATHS=$(
4635
gh api \
4736
--paginate \
@@ -82,104 +71,40 @@ jobs:
8271
echo '```'
8372
}
8473
85-
HAS_TRUE_POSITIVE_SIGNAL=false
86-
LABEL_ACTION="not needed (no restricted paths)"
87-
PUBLIC_MEMBER_CHECK="not needed (no restricted paths)"
88-
TRUE_POSITIVE_SIGNALS="(none)"
89-
74+
IS_ALLOWED=false
9075
case "$AUTHOR_ASSOCIATION" in
91-
MEMBER|OWNER)
92-
HAS_TRUE_POSITIVE_SIGNAL=true
93-
LABEL_ACTION="not needed (author association is a true positive)"
94-
PUBLIC_MEMBER_CHECK="skipped (author association is a true positive)"
95-
TRUE_POSITIVE_SIGNALS="author_association:$AUTHOR_ASSOCIATION"
76+
COLLABORATOR|MEMBER|OWNER)
77+
IS_ALLOWED=true
9678
;;
9779
esac
9880
99-
if [ "$TOUCHES_RESTRICTED_PATHS" = "true" ] && [ "$HAS_TRUE_POSITIVE_SIGNAL" = "false" ]; then
100-
PUBLIC_MEMBER_STATUS=$(curl \
101-
--silent \
102-
--show-error \
103-
--output /dev/null \
104-
--write-out '%{http_code}' \
105-
-H "Authorization: Bearer $GH_TOKEN" \
106-
-H "Accept: application/vnd.github+json" \
107-
-H "X-GitHub-Api-Version: 2022-11-28" \
108-
"$GITHUB_API_URL/orgs/$PUBLIC_MEMBER_ORG/public_members/$PR_AUTHOR")
109-
110-
case "$PUBLIC_MEMBER_STATUS" in
111-
204)
112-
HAS_TRUE_POSITIVE_SIGNAL=true
113-
LABEL_ACTION="not needed (public org membership is a true positive)"
114-
PUBLIC_MEMBER_CHECK="204 (public member)"
115-
TRUE_POSITIVE_SIGNALS="public_org_membership:$PUBLIC_MEMBER_ORG"
116-
;;
117-
404)
118-
PUBLIC_MEMBER_CHECK="404 (not a public member)"
119-
;;
120-
*)
121-
echo "::error::Failed to determine whether the PR author is a public $PUBLIC_MEMBER_ORG member."
122-
{
123-
echo "## PR Author Organization Check Failed"
124-
echo ""
125-
echo "- **Error**: Unexpected HTTP status from \`/orgs/$PUBLIC_MEMBER_ORG/public_members/$PR_AUTHOR\`: \`$PUBLIC_MEMBER_STATUS\`."
126-
echo "- **Author**: $PR_AUTHOR"
127-
echo "- **Author association**: $AUTHOR_ASSOCIATION"
128-
echo "- **Restricted paths**: \`cuda_bindings/\`, \`cuda_python/\`"
129-
echo ""
130-
write_matching_restricted_paths
131-
echo ""
132-
echo "Please update the PR at: $PR_URL"
133-
} >> "$GITHUB_STEP_SUMMARY"
134-
exit 1
135-
;;
136-
esac
137-
fi
138-
139-
LABEL_ALREADY_PRESENT=false
140-
if jq -e --arg label "$REVIEW_LABEL" '.[] == $label' <<<"$EXISTING_LABELS" >/dev/null; then
141-
LABEL_ALREADY_PRESENT=true
142-
fi
143-
144-
if [ "$TOUCHES_RESTRICTED_PATHS" = "true" ] && [ "$HAS_TRUE_POSITIVE_SIGNAL" = "false" ]; then
145-
if [ "$LABEL_ALREADY_PRESENT" = "true" ]; then
146-
LABEL_ACTION="already present"
147-
elif ! gh issue edit "$PR_NUMBER" --repo "$REPO" --add-label "$REVIEW_LABEL"; then
148-
echo "::error::Failed to add the $REVIEW_LABEL label."
149-
{
150-
echo "## PR Author Organization Check Failed"
151-
echo ""
152-
echo "- **Error**: Failed to add the \`$REVIEW_LABEL\` label."
153-
echo "- **Author**: $PR_AUTHOR"
154-
echo "- **Author association**: $AUTHOR_ASSOCIATION"
155-
echo "- **Public $PUBLIC_MEMBER_ORG membership check**: $PUBLIC_MEMBER_CHECK"
156-
echo ""
157-
write_matching_restricted_paths
158-
echo ""
159-
echo "Please update the PR at: $PR_URL"
160-
} >> "$GITHUB_STEP_SUMMARY"
161-
exit 1
162-
else
163-
LABEL_ACTION="added"
164-
fi
81+
if [ "$TOUCHES_RESTRICTED_PATHS" = "true" ] && [ "$IS_ALLOWED" = "false" ]; then
82+
echo "::error::This PR failed the author organization check. See the job summary for details."
83+
{
84+
echo "## PR Author Organization Check Failed"
85+
echo ""
86+
echo "- **Author**: $PR_AUTHOR"
87+
echo "- **Author association**: $AUTHOR_ASSOCIATION"
88+
echo "- **Restricted paths**: \`cuda_bindings/\`, \`cuda_python/\`"
89+
echo ""
90+
write_matching_restricted_paths
91+
echo ""
92+
echo "- **Policy**: See \`cuda_bindings/LICENSE\` and \`cuda_python/LICENSE\`. Only NVIDIA organization members may modify files under \`cuda_bindings/\` or \`cuda_python/\`."
93+
echo ""
94+
echo "Please update the PR at: $PR_URL"
95+
} >> "$GITHUB_STEP_SUMMARY"
96+
exit 1
16597
fi
16698
16799
{
168-
echo "## PR Author Organization Check Completed"
100+
echo "## PR Author Organization Check Passed"
169101
echo ""
170102
echo "- **Author**: $PR_AUTHOR"
171103
echo "- **Author association**: $AUTHOR_ASSOCIATION"
172104
echo "- **Touches restricted paths**: $TOUCHES_RESTRICTED_PATHS"
173105
echo "- **Restricted paths**: \`cuda_bindings/\`, \`cuda_python/\`"
174-
echo "- **Public $PUBLIC_MEMBER_ORG membership check**: $PUBLIC_MEMBER_CHECK"
175-
echo "- **True positive signals**: $TRUE_POSITIVE_SIGNALS"
176-
echo "- **Label action**: $LABEL_ACTION"
177106
if [ "$TOUCHES_RESTRICTED_PATHS" = "true" ]; then
178107
echo ""
179108
write_matching_restricted_paths
180109
fi
181-
if [ "$TOUCHES_RESTRICTED_PATHS" = "true" ] && [ "$HAS_TRUE_POSITIVE_SIGNAL" = "false" ]; then
182-
echo ""
183-
echo "- **Manual follow-up**: No true positive signal was found, so \`$REVIEW_LABEL\` is required."
184-
fi
185110
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)