Skip to content

[Webhooks] Add a github provider #58471

Closed as not planned
Closed as not planned
@tacman

Description

@tacman

Description

The providers on https://symfony.com/doc/current/webhook.html are for email and notifiers (like SMS). Since every developer using Symfony has a github account and many use github for their applications, a native github provider would be useful.

Example

use Symfony\Component\RemoteEvent\Attribute\AsRemoteEventConsumer;
use Symfony\Component\RemoteEvent\Consumer\ConsumerInterface;
use Symfony\Component\RemoteEvent\Event\Github\IssueEvent;
use Symfony\Component\RemoteEvent\Event\Github\PullRequestEvent;
use Symfony\Component\RemoteEvent\RemoteEvent;

#[AsRemoteEventConsumer('github')]
class WebhookListener implements ConsumerInterface
{
    public function consume(RemoteEvent $event): void
    {
        if ($event instanceof IssueEvent) {
            $this->handleIssueEvent($event);
        } elseif ($event instanceof PullRequestEvent) {
            $this->handlePullRequestEvent($event);
        } else {
            // This is not an Github event
            return;
        }
    }

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions