Skip to content

Commit b8d65c6

Browse files
author
Xin Li
committed
CI
1 parent 6c1ee93 commit b8d65c6

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
name: Copyright check
4+
5+
on:
6+
pull_request:
7+
8+
jobs:
9+
copyright-check:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Check SPDX copyright headers
15+
run: |
16+
set -euo pipefail
17+
18+
MISSING=()
19+
20+
# Check Python files (excluding auto-generated or vendored paths)
21+
while IFS= read -r -d '' f; do
22+
if ! head -5 "$f" | grep -q "SPDX-FileCopyrightText.*NVIDIA"; then
23+
MISSING+=("$f")
24+
fi
25+
done < <(find src analysis configs -name "*.py" -print0 2>/dev/null)
26+
27+
# Check shell scripts
28+
while IFS= read -r -d '' f; do
29+
if ! head -5 "$f" | grep -q "SPDX-FileCopyrightText.*NVIDIA"; then
30+
MISSING+=("$f")
31+
fi
32+
done < <(find src configs -name "*.sh" -print0 2>/dev/null)
33+
34+
# Check Jinja2 templates
35+
while IFS= read -r -d '' f; do
36+
if ! head -5 "$f" | grep -q "SPDX-FileCopyrightText.*NVIDIA"; then
37+
MISSING+=("$f")
38+
fi
39+
done < <(find src -name "*.j2" -print0 2>/dev/null)
40+
41+
if [ ${#MISSING[@]} -gt 0 ]; then
42+
echo "ERROR: The following files are missing an NVIDIA SPDX copyright header:"
43+
printf ' %s\n' "${MISSING[@]}"
44+
echo ""
45+
echo "Add the following header to each file:"
46+
echo " # SPDX-FileCopyrightText: Copyright (c) $(date +%Y) NVIDIA CORPORATION & AFFILIATES. All rights reserved."
47+
echo " # SPDX-License-Identifier: Apache-2.0"
48+
exit 1
49+
fi
50+
51+
echo "All checked files have NVIDIA SPDX copyright headers."

0 commit comments

Comments
 (0)