Skip to content

Timestamps to transcribe #171

Timestamps to transcribe

Timestamps to transcribe #171

Workflow file for this run

# Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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