Skip to content

Commit

Permalink
feat: pretty print event as json
Browse files Browse the repository at this point in the history
  • Loading branch information
aeddi committed Dec 2, 2024
1 parent 59c3ad6 commit ffdce93
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion contribs/github-bot/internal/matrix/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package matrix

import (
"context"
"encoding/json"
"errors"
"fmt"
"os"
Expand All @@ -21,7 +22,11 @@ func execMatrix(flags *matrixFlags) error {

// If verbose is set, print the Github Actions event for debugging purpose.
if *flags.verbose {
fmt.Println("Event:", actionCtx.Event)
jsonBytes, err := json.MarshalIndent(actionCtx.Event, "", " ")
if err != nil {
return fmt.Errorf("unable to marshal event to json: %w", err)
}
fmt.Println("Event:", string(jsonBytes))
}

// Init Github client using only GitHub Actions context.
Expand Down

0 comments on commit ffdce93

Please sign in to comment.