mirror of
https://github.com/czhu12/canine.git
synced 2025-12-30 15:49:54 -06:00
13 lines
371 B
Ruby
13 lines
371 B
Ruby
class Projects::RegisterGithubWebhook
|
|
extend LightService::Action
|
|
expects :project
|
|
|
|
executed do |context|
|
|
client = Github::Client.from_project(context.project)
|
|
client.register_webhook!
|
|
rescue Octokit::UnprocessableEntity => e
|
|
next context if e.message.include?("Hook already exists")
|
|
context.fail_and_return!("Failed to create webhook")
|
|
end
|
|
end
|