Create formatter for GitHub Actions #746
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds a formatter for use with GitHub Actions.
The output of this formatter is meant to work as an actions annotation, as per the Actions Docs.
For example, if I had a file within my
Utilities
module that had an unused function, it would be output this way:Usage
Note
Failure to specify
--relative-results
will result in a usage error being thrown instructing the user to use--relative-results
. GitHub Actions specifically wants relative paths.When used in CI, we get results directly on pull requests.
New class and methods:
Sources/PeripheryKit/Formatters/ActionsFormatter.swift
: Introduced a newActionsFormatter
class with aformat
method to format scan results. This class requires therelativeResults
configuration to be set, otherwise, it throws aPeripheryError.usageError
.Enum extension:
Sources/Shared/OutputFormat.swift
: Extended theOutputFormat
enum to include a new caseactions
.Sources/PeripheryKit/Formatters/OutputFormatter.swift
: Updated theOutputFormat
extension to returnActionsFormatter.self
when theactions
case is selected.