Skip to content

Commit

Permalink
refactor: use constants instead of hardcoded event strings
Browse files Browse the repository at this point in the history
  • Loading branch information
HandOfGod94 committed Sep 12, 2023
1 parent 7717eb3 commit cae4e31
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/jira_changelog/git/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ const (
InitialState = State("initial_state")
CommandExecuted = State("command_executed")
OutuptParsed = State("output_parsed")
ExecuteGitLog = Event("execute_git_log")
ParseOutput = Event("parse_output")

ExecuteGitLog = Event("execute_git_log")
ParseOutput = Event("parse_output")
)

type commitParseWorkflow struct {
Expand Down Expand Up @@ -70,12 +71,12 @@ func NewCommitParseWorkflow(fromRef, toRef string) *commitParseWorkflow {
}

func (cpw *commitParseWorkflow) Commits(ctx context.Context) ([]Commit, error) {
err := cpw.FSM.Event(ctx, "execute_git_log")
err := cpw.FSM.Event(ctx, ExecuteGitLog)
if err != nil {
return []Commit{}, fmt.Errorf("failed to execute git log. %w", err)
}

err = cpw.FSM.Event(ctx, "parse_output")
err = cpw.FSM.Event(ctx, ParseOutput)
if err != nil {
return []Commit{}, fmt.Errorf("failed to parse output. %w", err)
}
Expand Down

0 comments on commit cae4e31

Please sign in to comment.