Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update copyright check #11168

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 3 additions & 40 deletions .github/workflows/copyright-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Copyright check

on:
pull_request:

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.run_id }}
fetch-depth: 0

- name: Check files have copyright notice
run: |
cd ${{ github.run_id }}

# Files ending with .py should have Copyright notice in the first 10 lines
find_files_with_missing_copyright() {
find ./ -type f -name '*.py' -not -path "./.git/*" -not -path "./*__init__.py" | while read path; do
echo -en $path"\t"
head -n 10 $path | tr '\n' '\t' | sed 's/\t$/\n/'
done \
| egrep -iv 'Copyright.*NVIDIA CORPORATION.*' \
| egrep -iv '*MIT.*Licen.e.*' \
| egrep -iv '*Copyright.*Apache.*' \
| egrep -iv '*Apache.*License.*' \
| while read line; do
echo $line | cut -d' ' -f1
done
}


declare RESULT=($(find_files_with_missing_copyright)) # (..) = array

if [ "${#RESULT[@]}" -gt 0 ]; then
echo "Error: Found files with missing copyright:"
for (( i=0; i<"${#RESULT[@]}"; i++ )); do
echo "path= ${RESULT[$i]}"
done
exit 1;
else
echo "Ok: All (Python) files start with copyright notice"
fi
copyright-check:
uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/[email protected]
Loading