{%- if server %} 
# 
# For provisioning Provisioning
#
- id: provisioning
  execute-command: {{taskserv.webhook_home}}/provisioning_hook.sh
  command-working-directory: {{taskserv.webhook_home}}
  response-message: I got the webhook payload!
  response-headers:
  - name: Access-Control-Allow-Origin
    value: '*'
  pass-arguments-to-command:
  - source: entire-payload
  pass-environment-to-command:
  - source: payload
    name: repository.clone_url
    envname: REPOSITORY_URL
  - source: payload
    name: repository.full_name
    envname: REPOSITORY_NAME
  - source: payload
    name: head_commit.id
    envname: HEAD_COMMIT_ID
  - source: payload
    name: pusher.name
    envname: PUSHER_NAME
  - source: payload
    name: pusher.email
    envname: PUSHER_EMAIL
  trigger-rule:
    and:
    - match:
        type: value
        value: refs/heads/main
        parameter:
          source: payload
          name: ref
#
# For services
#
- id: service
  execute-command: {{taskserv.webhook_home}}/srvc_hook.sh
  command-working-directory: {{taskserv.webhook_home}}
  response-message: I got the service payload !
  response-headers:
  - name: Access-Control-Allow-Origin
    value: '*'
  pass-arguments-to-command:
  - source: entire-payload
  pass-environment-to-command:
  - source: payload
    name: repository.clone_url
    envname: REPOSITORY_URL
  - source: payload
    name: repository.full_name
    envname: REPOSITORY_NAME
  - source: payload
    name: head_commit.id
    envname: HEAD_COMMIT_ID
  - source: payload
    name: pusher.name
    envname: PUSHER_NAME
  - source: payload
    name: pusher.email
    envname: PUSHER_EMAIL
  trigger-rule:
    and:
    # - match:
    #     type: value
    #     value: "SECRET"
    #     parameter:
    #       source: playload
    #       name: secret
    - match:
        type: value
        value: refs/heads/main
        parameter:
          source: payload
          name: ref
{%- endif %}
