Skip to content

Commit

Permalink
Merge pull request #56 from herbetom/addApproveHookAction
Browse files Browse the repository at this point in the history
gitlab: use HookActions map only if it is necessary
  • Loading branch information
fleaz committed Aug 11, 2020
2 parents 76e7433 + dd0b3af commit 0cc6ecd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions input/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ func (m GitlabModule) GetHandler() http.HandlerFunc {
return
}

mergeEvent.Merge.Action = HookActions[mergeEvent.Merge.Action]
if action, ok := HookActions[mergeEvent.Merge.Action]; ok {
mergeEvent.Merge.Action = action
}

mergeTemplate.Execute(&buf, &mergeEvent)

Expand All @@ -350,7 +352,9 @@ func (m GitlabModule) GetHandler() http.HandlerFunc {
return
}

issueEvent.Issue.Action = HookActions[issueEvent.Issue.Action]
if action, ok := HookActions[issueEvent.Issue.Action]; ok {
issueEvent.Issue.Action = action
}

issueTemplate.Execute(&buf, &issueEvent)

Expand Down

0 comments on commit 0cc6ecd

Please sign in to comment.