Skip to content

Conversation

@MrPeterss
Copy link
Contributor

No description provided.

Comment on lines 12 to 65
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install SwiftLint
run: |
# Download and install SwiftLint using the correct URL for Linux AMD64
SWIFTLINT_VERSION="0.61.0"
echo "Installing SwiftLint $SWIFTLINT_VERSION..."

curl -L -o swiftlint.zip "https://github.com/realm/SwiftLint/releases/download/${SWIFTLINT_VERSION}/swiftlint_linux_amd64.zip"
unzip swiftlint.zip
chmod +x swiftlint
sudo mv swiftlint /usr/local/bin/

# Verify installation
echo "SwiftLint installed successfully:"
swiftlint version

- name: Run SwiftLint
run: |
# Get list of changed Swift files in specific folders, properly handling spaces
echo "🔍 Collecting Swift files to lint..."

# Collect all Swift files to lint
files_to_lint=""
file_count=0

# Use git diff to get changed files, handling spaces with null-termination
# Filter for Swift files only in the specified directories
while IFS= read -r -d '' file; do
if [ -f "$file" ]; then
files_to_lint="$files_to_lint\"$file\" "
file_count=$((file_count + 1))
fi
done < <(git diff --name-only --diff-filter=ACM origin/${{ github.base_ref }}...HEAD -z | \
grep -z '\.swift$' | \
grep -zE '^(Eatery Blue/|EateryGetAPI/|EateryModel/)')

echo "📝 Found $file_count Swift files to lint"

if [ $file_count -eq 0 ]; then
echo "✅ No Swift files to lint in the specified directories"
exit 0
fi

echo ""
echo "🚀 Running SwiftLint on all files..."
echo ""

# Run SwiftLint on all files at once with clean output
eval "swiftlint lint --strict --quiet --config .swiftlint.yml $files_to_lint"

Check warning

Code scanning / CodeQL

Workflow does not contain permissions

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
@MrPeterss MrPeterss merged commit 2714811 into release Dec 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants