Skip to content

Commit

Permalink
Improve github events class naming
Browse files Browse the repository at this point in the history
  • Loading branch information
danidoni committed Feb 7, 2023
1 parent bd0290a commit 92494f6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Github
class GithubPayload
attr_reader :event, :webhook_payload

def initialize(event, webhook_payload)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Github::PullRequest < Github
class GithubPayload::PullRequest < GithubPayload
def payload
default_payload.merge(
commit_sha: webhook_payload.dig(:pull_request, :head, :sha),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Github::Push < Github
class GithubPayload::Push < GithubPayload
def payload
payload_ref = webhook_payload.fetch(:ref, '')
payload = default_payload.merge(
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/models/github_payload_extractor.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class GithubPayloadExtractor < ScmPayloadExtractor
EVENT_CLASSES = {
'pull_request' => Github::PullRequest,
'push' => Github::Push
'pull_request' => GithubPayload::PullRequest,
'push' => GithubPayload::Push
}.freeze

attr_reader :event, :webhook_payload
Expand Down

0 comments on commit 92494f6

Please sign in to comment.