nanaweb / github-listener-bundle
v0.9.2
2019-07-09 14:57 UTC
Requires
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^7.5
- symfony/annotations-pack: ^1.0
- symfony/framework-bundle: ~4.3
- symfony/security: ^4.3
- symfony/test-pack: ^1.0
- symfony/yaml: ^4.3
This package is auto-updated.
Last update: 2024-09-10 02:43:29 UTC
README
如何安装
composer require nanaweb/github-listener-bundle:"~0.9"
然后,将 Nanaweb\GithubListenerBundle\NanawebGithubListenerBundle
添加到 AppKernel 中注册的包列表。无需配置。
如何使用
为 github webhook 事件 创建自己的 OperationRunner
类。OperationRunners 必须实现 Nanaweb\GithubListenerBundle\OperationRunner\OperationRunnerInterface
接口。
使用 nanaweb_github_listener.operation_runner
标签和 event
属性注册到 Symfony DI 容器中,如下所示
services:
fake_operation_runner:
class: App\GithubListener\OperationRunner\MyOperationRunner
tags:
- { name: nanaweb_github_listener.operation_runner, event: pull_request }
如何保护你的 webhook
使用 Nanaweb\GithubListenerBundle\Security\Guard\GithubWebhookAuthenticator
配置你的 guard 安全设置
# config/packages/security.yaml
security:
# ...
firewalls:
# ...
main:
anonymous: ~
logout: ~
guard:
authenticators:
- Nanaweb\GithubListenerBundle\Security\Guard\GithubWebhookAuthenticator
别忘了为 ReceiveController 添加 access_control 配置
# config/packages/security.yaml
security:
# ...
access_control:
- { path: ^/nanaweb-github-listener/receive, roles: ROLE_GITHUB_WEBHOOK }