Page MenuHomeDevCentral

No OneTemporary

diff --git a/app/Listeners/DockerHubListener.php b/app/Listeners/DockerHubListener.php
index 5c8874d..33acfe6 100644
--- a/app/Listeners/DockerHubListener.php
+++ b/app/Listeners/DockerHubListener.php
@@ -1,81 +1,81 @@
<?php
namespace Nasqueron\Notifications\Listeners;
use Nasqueron\Notifications\Events\GitHubPayloadEvent;
use Nasqueron\Notifications\Jobs\TriggerDockerHubBuild;
use Illuminate\Events\Dispatcher;
use DockerHub;
/**
* Listens to events Docker Hub is interested by.
*/
class DockerHubListener {
///
- /// GitHub → Phabricator
+ /// GitHub → Docker Hub
///
/**
* Handles payload events.
*
* @param GitHubPayloadEvent $event The GitHub payload event
*/
public function onGitHubPayload (GitHubPayloadEvent $event) : void {
if ($this->shouldNotify($event)) {
$this->notifyNewCommits($event);
}
}
/**
* Determines if the event should be notified to Docker Hub.
* We're interested by push events, for repos with Docker images
* we've a token to trigger a build.
*
* @param GitHubPayloadEvent $event The GitHub payload event
* @return bool
*/
public function shouldNotify (GitHubPayloadEvent $event) : bool {
return $event->event === 'push'
&& DockerHub::hasToken($this->getRepository($event));
}
/**
- * Notifies Phabricator there are new commits to pull.
+ * Notifies Docker Hub to rebuild image.
*
* @param GitHubPayloadEvent $event The GitHub payload event
*/
public function notifyNewCommits (GitHubPayloadEvent $event) : void {
$job = new TriggerDockerHubBuild($this->getRepository($event));
$job->handle();
}
/**
* Extracts repository fullname (e.g. acme/foo) from event.
*
* @var string
*/
private function getRepository (GitHubPayloadEvent $event) : string {
return $event->payload->repository->full_name;
}
///
/// Events listening
///
/**
* Registers the listeners for the subscriber.
*
* @param Dispatcher $events
*/
public function subscribe (Dispatcher $events) : void {
$class = DockerHubListener::class;
$events->listen(
GitHubPayloadEvent::class,
"$class@onGitHubPayload"
);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 06:31 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259612
Default Alt Text
(2 KB)

Event Timeline