Skip to content

Skip swift version license check #127

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
17 changes: 11 additions & 6 deletions .github/workflows/scripts/check-license-header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ fi

paths_with_missing_license=( )

static_exclude_list=( )
static_exclude_list+=( '":(exclude).license_header_template"' )
static_exclude_list+=( '":(exclude).swift-version"' ) # Swift version files do not have comments nor licenses in them
dynamic_exclude_list=( )

if [[ -f .licenseignore ]]; then
static_exclude_list='":(exclude).licenseignore" ":(exclude).license_header_template" '
dynamic_exclude_list=$(tr '\n' '\0' < .licenseignore | xargs -0 -I% printf '":(exclude)%" ')
exclude_list=$static_exclude_list$dynamic_exclude_list
else
exclude_list=":(exclude).license_header_template"
static_exclude_list+=( '":(exclude).licenseignore"' )
readarray -t dynamic_exclude_list <<< "$(sed -E 's/^(.*)$/":(exclude)\1"/' <.licenseignore)"
fi

file_paths=$(echo "$exclude_list" | xargs git ls-files)
exclude_list=( "${static_exclude_list[@]}" "${dynamic_exclude_list[@]}" )
excludes=$(IFS=" " ; echo "${exclude_list[*]}")

file_paths=$(echo "$excludes" | xargs git ls-files)

while IFS= read -r file_path; do
file_basename=$(basename -- "${file_path}")
Expand Down
1 change: 1 addition & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.github/workflows/configs/.flake8
**/*.yml
**/*.java
CODEOWNERS
LICENSE.txt
README.md
1 change: 1 addition & 0 deletions tests/no-license.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Look, no license
Loading