WebHook broker that accepts notifications from multiple platforms and performs simple actions in response
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

docker.py 720B

123456789101112131415161718192021
  1. from .service import Service
  2. class Docker(Service):
  3. def __init__(self):
  4. super().__init__("docker")
  5. def accept_hook(self, identifier, request):
  6. for event in request.get_json()["events"]:
  7. if (
  8. event["action"] == "push"
  9. and "vnd.docker.distribution.manifest" in event["target"]["mediaType"]
  10. and "tag" in event["target"]
  11. ):
  12. yield {
  13. "type": "docker.push",
  14. "repo": event["target"]["repository"],
  15. "tag": event["target"]["tag"],
  16. "host": event["request"]["host"],
  17. "user": event["actor"]["name"],
  18. }