apiVersion: v1
data:
  hooks.yml: |-
    - id: deploy_statuspage
      execute-command: /opt/deploy_statuspage.sh
      command-working-directory: /opt
      response-message: I got the payload!
      pass-arguments-to-command:
      - source: payload
        name: pull_request.url
      trigger-rule:
        and:
        - match:
            type: payload-hash-sha1
            secret: mysecret    # Manually change this in production
            parameter:
              source: header
              name: X-Hub-Signature
        - match:
            type: value
            value: pull_request
            parameter:
              source: header
              name: X-GitHub-Event
        - match:
            type: value
            value: closed
            parameter:
              source: payload
              name: action
        - match:
            type: value
            value: "BCDevOps/platform-services"
            parameter:
              source: payload
              name: repository.full_name
    - id: update_notifications
      execute-command: /opt/update_notifications.sh
      command-working-directory: /opt
      response-message: I got the payload!
      pass-arguments-to-command:
      - source: payload
        name: repository.html_url
      - source: payload
        name: ref
      - source: payload
        name: number
      - source: payload
        name: head.repo.owner.login
      - source: payload
        name: url
      trigger-rule:
        and:
        - match:
            type: payload-hash-sha1
            secret: mysecret    # Manually change this in production
            parameter:
              source: header
              name: X-Hub-Signature
        - match:
            type: value
            value: pull_request
            parameter:
              source: header
              name: X-GitHub-Event
        - match:
            type: value
            value: closed
            parameter:
              source: payload
              name: action
        - match:
            type: value
            value: "BCDevOps/platform-services-status-page-notifications"
            parameter:
              source: payload
              name: repository.full_name
kind: ConfigMap
metadata:
  name: webhook-ansible-hooks
