$if: '(event.event in build.allowed) && (build.ref_match in event.head.ref)'
then:
  taskId: ${taskcluster.taskId}
  provisionerId: ${taskcluster.script.provisionerId}
  workerType: ${taskcluster.script.workerType}
  taskGroupId: ${taskcluster.taskGroupId}
  schedulerId: ${taskcluster.schedulerId}
  dependencies:
    $map: { $eval: build.dependencies }
    each(b):
      $eval: as_slugid(b)
  created: { $fromNow: '0 sec' }
  deadline: { $fromNow: '1 day' }
  expires:
    $if: '(event.event == "push") || (event.event == "tag")'
    then: { $fromNow: '6 months' }
    else: { $fromNow: '7 days' }

  extra:
    github:
      $if: '(event.event == "push") || (event.event == "tag")'
      then: { $eval: taskcluster.github_events.merge }
      else: { $eval: taskcluster.github_events.pull_request }

  routes:
    { $eval: build.routes }

  payload:
    artifacts_deps:
      python:
        $map: { $eval: build.artifacts_deps.python }
        each(b):
          $eval: as_slugid(b)
      javascript:
        $map: { $eval: build.artifacts_deps.javascript }
        each(b):
          $eval: as_slugid(b)
      cpp:
        $map: { $eval: build.artifacts_deps.cpp }
        each(b):
          $eval: as_slugid(b)

  metadata:
    name: ${build.metadata.name}
    description: ${build.metadata.description}
    owner: ${event.head.user.email}
    source: ${event.head.repo.url}
