Skip to content

Instantly share code, notes, and snippets.

@Coledunsby
Created January 30, 2023 17:21
Show Gist options
  • Select an option

  • Save Coledunsby/8b24baed35382d551de9afe0338eeb5b to your computer and use it in GitHub Desktop.

Select an option

Save Coledunsby/8b24baed35382d551de9afe0338eeb5b to your computer and use it in GitHub Desktop.
Convert SwiftLint's output into GitHub Actions Logging commands
#!/bin/bash
# modified from https://github.com/norio-nomura/action-swiftlint
# convert swiftlint's output into GitHub Actions Logging commands
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/development-tools-for-github-actions#logging-commands
function convertToGitHubActionsLoggingCommands() {
sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 file=\1,line=\2,col=\3::\5/'
}
set -o pipefail && mint run swiftlint --strict | convertToGitHubActionsLoggingCommands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment