File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 2424 - uses : actions/checkout@master
2525 - name : Checks for License file
2626 run : |
27- if ! [[ -f "LICENSE" || -f "License.txt" || -f "LICENSE.md" ]]; then exit 1; fi
27+ expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt")
28+ license_file_found=false
29+ current_year=$(date +"%Y")
30+
31+ for license_file in "${expected_license_files[@]}"; do
32+ if [ -f "$license_file" ]; then
33+ license_file_found=true
34+ # check the license file for the current year, if not exists, exit with error
35+ if ! grep -q "$current_year" "$license_file"; then
36+ echo "License file $license_file does not contain the current year."
37+ exit 2
38+ fi
39+ break
40+ fi
41+ done
42+
43+ if [ "$license_file_found" = false ]; then
44+ echo "No license file found. Please add a license file to the repository."
45+ exit 1
46+ fi
You can’t perform that action at this time.
0 commit comments