Skip to content
Open
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM norionomura/swiftlint:swift-5
FROM norionomura/swiftlint:0.59.1-slim
LABEL version="3.2.1"
LABEL repository="https://github.com/norio-nomura/action-swiftlint"
LABEL homepage="https://github.com/norio-nomura/action-swiftlint"
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: 'GitHub Action for SwiftLint'
description: 'A tool to enforce Swift style and conventions'
author: 'Norio Nomura <norio.nomura@gmail.com>'
outputs:
violations_count:
description: 'Number of found violations'
serious_violations_count:
description: 'Number of serious violations'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
13 changes: 12 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ function convertToGitHubActionsLoggingCommands() {
sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 file=\1,line=\2,col=\3::\5/'
}

function parseOutputsParameters() {
input_value=$( cat )
violations=$(echo "$input_value" | grep -E '::warning|::error' -c)
errors=$(echo "$input_value" | grep -E 'error' -c)
echo "$input_value"
echo "::set-output name=violations_count::$violations"
echo "::set-output name=serious_violations_count::$errors"
}


if ! ${WORKING_DIRECTORY+false};
then
cd ${WORKING_DIRECTORY}
Expand All @@ -31,4 +41,5 @@ then
fi
fi

set -o pipefail && swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands
echo "Using swiftlint version: `swiftlint --version`"
set -o pipefail && swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands | parseOutputsParameters