Skip to content

Commit

Permalink
More events and extensions (#120)
Browse files Browse the repository at this point in the history
* Update events.go

added more events and added metadata to filter on

* Update handler.go

added more events and added metadata to filter on

* Capitalize constants so they can be reused when parsing events
  • Loading branch information
nnordrum authored Mar 24, 2021
1 parent cf129c8 commit 8cc414a
Show file tree
Hide file tree
Showing 3 changed files with 244 additions and 24 deletions.
12 changes: 6 additions & 6 deletions pkg/apis/sources/v1alpha1/githubsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,25 @@ type SecretValueFromSource struct {
}

const (
// gitHubEventTypePrefix is what all GitHub event types get
// GitHubEventTypePrefix is what all GitHub event types get
// prefixed with when converting to CloudEvents.
gitHubEventTypePrefix = "dev.knative.source.github"
GitHubEventTypePrefix = "dev.knative.source.github"

// gitHubEventSourcePrefix is what all GitHub event sources get
// GitHubEventSourcePrefix is what all GitHub event sources get
// prefixed with when converting to CloudEvents.
gitHubEventSourcePrefix = "https://github.com"
GitHubEventSourcePrefix = "https://github.com"
)

// GitHubEventType returns an event type emitted by a GitHubSource suitable for
// the value of a CloudEvent's "type" context attribute.
func GitHubEventType(ghEventType string) string {
return fmt.Sprintf("%s.%s", gitHubEventTypePrefix, ghEventType)
return fmt.Sprintf("%s.%s", GitHubEventTypePrefix, ghEventType)
}

// GitHubEventSource returns a unique representation of a GitHubSource suitable
// for the value of a CloudEvent's "source" context attribute.
func GitHubEventSource(ownerAndRepo string) string {
return fmt.Sprintf("%s/%s", gitHubEventSourcePrefix, ownerAndRepo)
return fmt.Sprintf("%s/%s", GitHubEventSourcePrefix, ownerAndRepo)
}

const (
Expand Down
Loading

0 comments on commit 8cc414a

Please sign in to comment.