$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' }

  routes:
    { $eval: build.routes }

  payload:
    upload_targets: { $eval: build.upload_targets }
    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)
      java_aar:
        $map: { $eval: build.artifacts_deps.java_aar }
        each(b):
          $eval: as_slugid(b)
      cpp:
        $map: { $eval: build.artifacts_deps.cpp }
        each(b):
          $eval: as_slugid(b)
      nuget:
        $map: { $eval: build.artifacts_deps.nuget }
        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}
