From f6c9d3cf2100c9399b98f1b29c08ba7b24b08a31 Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Fri, 27 Nov 2020 21:09:59 +0200 Subject: [PATCH 1/3] Add output parameters 'violations_count' and 'serious_violations_count' --- action.yml | 5 +++++ entrypoint.sh | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 022170e..a41dbe2 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,11 @@ name: 'GitHub Action for SwiftLint' description: 'A tool to enforce Swift style and conventions' author: 'Norio Nomura ' +outputs: + violations_count: + description: 'Number of found violations' + serious_violations_count: + description: 'Number of serious violations' runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index a01922b..680d0a3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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} @@ -31,4 +41,4 @@ then fi fi -set -o pipefail && swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands +set -o pipefail && swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands | parseOutputsParameters From a28ad35cde40ddec1fb5b219cedfdfd5cff5b7e0 Mon Sep 17 00:00:00 2001 From: Nick Beadman Date: Fri, 18 Apr 2025 15:05:04 -0700 Subject: [PATCH 2/3] SwiftLint 0.58.2 (#1) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d7ef8f4..6188088 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM norionomura/swiftlint:swift-5 +FROM norionomura/swiftlint:0.58.2 LABEL version="3.2.1" LABEL repository="https://github.com/norio-nomura/action-swiftlint" LABEL homepage="https://github.com/norio-nomura/action-swiftlint" From f1a059c560385290a6a447150ba3c6775b915865 Mon Sep 17 00:00:00 2001 From: Nick Beadman Date: Fri, 18 Apr 2025 15:18:52 -0700 Subject: [PATCH 3/3] SwiftLint 0.58.2 (#2) --- Dockerfile | 2 +- entrypoint.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6188088..bdb03a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM norionomura/swiftlint:0.58.2 +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" diff --git a/entrypoint.sh b/entrypoint.sh index 680d0a3..ed34be8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -41,4 +41,5 @@ then fi fi +echo "Using swiftlint version: `swiftlint --version`" set -o pipefail && swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands | parseOutputsParameters