Skip to content

Commit

Permalink
github-action-log: support severity level
Browse files Browse the repository at this point in the history
  • Loading branch information
haya14busa committed Jul 25, 2020
1 parent 3872614 commit ab25a4a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion service/github/githubutils/comment_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (lw *GitHubActionLogWriter) Flush(_ context.Context) error {
// ReportAsGitHubActionsLog reports results via logging command to create
// annotations.
// https://help.github.com/en/actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions#example-5
func ReportAsGitHubActionsLog(toolName, level string, d *rdf.Diagnostic) {
func ReportAsGitHubActionsLog(toolName, defaultLevel string, d *rdf.Diagnostic) {
mes := fmt.Sprintf("[%s] reported by reviewdog 馃惗\n%s\n\nRaw Output:\n%s",
toolName, d.GetMessage(), d.GetOriginalOutput())
loc := d.GetLocation()
Expand All @@ -58,6 +58,14 @@ func ReportAsGitHubActionsLog(toolName, level string, d *rdf.Diagnostic) {
Col: int(start.GetColumn()),
}

level := defaultLevel
switch d.Severity {
case rdf.Severity_ERROR:
level = "error"
case rdf.Severity_INFO, rdf.Severity_WARNING:
level = "warning"
}

switch level {
// no info command with location data.
case "warning", "info":
Expand Down

0 comments on commit ab25a4a

Please sign in to comment.