Skip to content

Commit ad7c96b

Browse files
authored
Add assignee check to PR metadata workflow (#1823)
Also trigger on assigned/unassigned events and report missing assignees alongside the existing label and milestone checks. Made-with: Cursor
1 parent 613be11 commit ad7c96b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/pr-metadata-check.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,30 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
name: "CI: Enforce label/milestone on PRs"
5+
name: "CI: Enforce assignee/label/milestone on PRs"
66

77
on:
88
pull_request_target:
99
types:
1010
- opened
1111
- edited
1212
- synchronize
13+
- assigned
14+
- unassigned
1315
- labeled
1416
- unlabeled
1517
- reopened
1618
- ready_for_review
1719

1820
jobs:
1921
check-metadata:
20-
name: PR has labels and milestone
22+
name: PR has assignee, labels, and milestone
2123
if: github.repository_owner == 'NVIDIA'
2224
runs-on: ubuntu-latest
2325
steps:
24-
- name: Check for labels and milestone
26+
- name: Check for assignee, labels, and milestone
2527
env:
28+
ASSIGNEES: ${{ toJson(github.event.pull_request.assignees) }}
2629
LABELS: ${{ toJson(github.event.pull_request.labels) }}
2730
MILESTONE: ${{ github.event.pull_request.milestone && github.event.pull_request.milestone.title || '' }}
2831
PR_URL: ${{ github.event.pull_request.html_url }}
@@ -34,11 +37,16 @@ jobs:
3437
exit 0
3538
fi
3639
37-
LABEL_NAMES=$(echo "$LABELS" | jq -r '.[].name')
3840
ERRORS=""
3941
42+
ASSIGNEE_COUNT=$(echo "$ASSIGNEES" | jq 'length')
43+
if [ "$ASSIGNEE_COUNT" -eq 0 ]; then
44+
ERRORS="${ERRORS}- **Missing assignee**: assign at least one person to this PR.\n"
45+
fi
46+
4047
# Module labels identify which package the PR touches.
4148
# Cross-cutting labels exempt PRs from needing a module label.
49+
LABEL_NAMES=$(echo "$LABELS" | jq -r '.[].name')
4250
MODULE_LABELS="cuda.bindings cuda.core cuda.pathfinder"
4351
MODULE_EXEMPT_LABELS="CI/CD"
4452
HAS_MODULE=false
@@ -98,10 +106,12 @@ jobs:
98106
exit 1
99107
fi
100108
109+
ASSIGNEE_LIST=$(echo "$ASSIGNEES" | jq -r '.[].login' | paste -sd ', ' -)
101110
LABEL_LIST=$(echo "$LABEL_NAMES" | paste -sd ', ' -)
102111
{
103112
echo "## PR Metadata Check Passed"
104113
echo ""
114+
echo "- **Assignees**: $ASSIGNEE_LIST"
105115
echo "- **Labels**: $LABEL_LIST"
106116
echo "- **Milestone**: $MILESTONE"
107117
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)