Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
fix(vcs): add support for different workflow types
Browse files Browse the repository at this point in the history
  • Loading branch information
ybelMekk committed Nov 4, 2022
1 parent c416cb6 commit 8af5869
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/vcs/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ type Event struct {
}

type EventMetadata struct {
WorkFlowRun *WorkFlow `json:"workflow_run"`
HeadCommit *HeadCommit `json:"head_commit"`
}

type WorkFlow struct {
HeadCommit *HeadCommit `json:"head_commit"`
}

Expand All @@ -27,9 +32,17 @@ func ParseEvent(inputs []byte) (*Event, error) {
}

func (in *Event) GetHeadCommitId() string {
if in.EventMetadata.WorkFlowRun != nil {
return in.EventMetadata.WorkFlowRun.HeadCommit.Id
}

return in.EventMetadata.HeadCommit.Id
}

func (in *Event) GetHeadCommitTimestamp() string {
if in.EventMetadata.WorkFlowRun != nil {
return in.EventMetadata.WorkFlowRun.HeadCommit.Timestamp
}

return in.EventMetadata.HeadCommit.Timestamp
}

0 comments on commit 8af5869

Please sign in to comment.