Skip to content
Merged
Show file tree
Hide file tree
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
31 changes: 20 additions & 11 deletions .github/workflows/license_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ jobs:
failed=0
# Find files: .sh, .go, .swift, .py
# Exclude hidden directories/files (like inside .git)
files=$(find . -type f \( -name "*.sh" -o -name "*.go" -o -name "*.swift" -o -name "*.py" \) -not -path '*/.*')
files=$(find . -type f \( -name "*.sh" -o -name "*.go" -o -name "*.swift" -o -name "*.py" -o -name "README.md" \) -not -path '*/.*')

for file in $files; do
if [ "$file" = "./README.md" ]; then
continue
fi

missing_reqs=0

# Requirement 1: A line with both "Copyright" and "Jamf"
Expand All @@ -28,16 +32,21 @@ jobs:
missing_reqs=1
fi

# Requirement 2: Specific license string
if ! grep -Fq "This work is licensed under the terms of the Jamf Source Available License" "$file"; then
echo "::error file=$file::Missing 'This work is licensed under the terms of the Jamf Source Available License'"
missing_reqs=1
fi

# Requirement 3: License URL
if ! grep -Fq "https://github.com/jamf/scripts/blob/main/LICENCE.md" "$file"; then
echo "::error file=$file::Missing 'https://github.com/jamf/scripts/blob/main/LICENCE.md'"
missing_reqs=1
filename=$(basename "${file}")
if [ "${filename}" = "README.md" ]; then
echo "skipping license check for: ${file}"
else
# Requirement 2: Specific license string
if ! grep -Fq "This work is licensed under the terms of the Jamf Source Available License" "$file"; then
echo "::error file=$file::Missing 'This work is licensed under the terms of the Jamf Source Available License'"
missing_reqs=1
fi

# Requirement 3: License URL
if ! grep -Fq "https://github.com/jamf/scripts/blob/main/LICENCE.md" "$file"; then
echo "::error file=$file::Missing 'https://github.com/jamf/scripts/blob/main/LICENCE.md'"
missing_reqs=1
fi
fi

if [ $missing_reqs -eq 1 ]; then
Expand Down
File renamed without changes.
Loading