{
  "$id": "https://firefox-ci-tc.services.mozilla.com/schemas/common/action-schema-v1.json#",
  "$schema": "http://json-schema.org/draft-06/schema#",
  "additionalProperties": false,
  "definitions": {
    "context": {
      "default": [],
      "description": "The `context` property determines in what context the action is\nrelevant. Thus, what context the action should be presented to the\nend-user.\n",
      "items": {
        "additionalProperties": {
          "maxLength": 4096,
          "type": "string"
        },
        "description": "A set of key-value pairs specifying a _tag-set_.\n",
        "title": "tag-set",
        "type": "object"
      },
      "type": "array",
      "uniqueItems": true
    },
    "description": {
      "description": "Human readable description of the action in markdown. This\ncan be displayed in a tooltip, popup and/or dialog when triggering\nthe action.\n",
      "maxLength": 4096,
      "type": "string"
    },
    "extra": {
      "description": "Extra data that the decision task wishes to include for use by other\nservices interpreting `actions.json`.  Consumers of this file are free to\nignore any and all data in this field.\n",
      "type": "object"
    },
    "name": {
      "description": "The name of this action.  This is used by user interfaces to\nidentify the action.\n",
      "maxLength": 255,
      "type": "string"
    },
    "schema": {
      "description": "JSON schema for user input to the action.  If this property is omitted,\nthen the input is `null`.\n"
    },
    "title": {
      "description": "Title text to be displayed on the button or link triggering the action.\n",
      "maxLength": 255,
      "type": "string"
    }
  },
  "description": "This document specifies the schema for the `public/actions.json` used by\n_decision tasks_ to expose actions that can be triggered by end-users.\n\nFor the purpose of this document the _consumer_ is the user-interface that\ndisplays task results to the end-user and allows end-users to trigger actions\ndefined by `public/actions.json`. A _consumer_ might be Treeherder.\nThe _end-user_ is a developer who is inspecting the results, and wishes to\ntrigger actions.\n",
  "properties": {
    "actions": {
      "description": "List of actions that can be triggered.\n",
      "items": {
        "anyOf": [
          {
            "additionalProperties": false,
            "properties": {
              "context": {
                "$ref": "#/definitions/context"
              },
              "description": {
                "$ref": "#/definitions/description"
              },
              "extra": {
                "$ref": "#/definitions/extra"
              },
              "kind": {
                "enum": [
                  "task"
                ]
              },
              "name": {
                "$ref": "#/definitions/name"
              },
              "schema": {
                "$ref": "#/definitions/schema"
              },
              "task": {
                "description": "Task template for triggering the action.\n\nWhen an action have been selected in the appropriate context and\ninput satisfying the `schema` (if any) has been collected. The\naction is triggered by parameterizing the task template given in\nthis property, and creating the resulting task.\n\nThe template is an object that is parameterized using\n[JSON-e](https://github.com/json-e/json-e), with the context\ndescribed in the documentation.\n",
                "title": "Task Template",
                "type": "object"
              },
              "title": {
                "$ref": "#/definitions/title"
              }
            },
            "required": [
              "kind",
              "title",
              "description",
              "task"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "context": {
                "$ref": "#/definitions/context"
              },
              "description": {
                "$ref": "#/definitions/description"
              },
              "extra": {
                "$ref": "#/definitions/extra"
              },
              "hookGroupId": {
                "description": "The `hookGroupId` of the hook to trigger to run this action",
                "title": "Hook Group ID",
                "type": "string"
              },
              "hookId": {
                "description": "The `hookId` of the hook to trigger to run this action",
                "title": "Hook ID",
                "type": "string"
              },
              "hookPayload": {
                "description": "JSON-e template that renders to the payload for `hooks.triggerHook`.\n\nThe template is an object that is parameterized using\n[JSON-e](https://github.com/json-e/json-e), with the\ncontext described in the documentation. The output of this\nrendering is provided as the payload to `hooks.triggerHook`\n(where it becomes the context for another JSON-e rendering\nstep - don't get the two confused!)\n",
                "title": "Hook Payload Template",
                "type": "object"
              },
              "kind": {
                "enum": [
                  "hook"
                ]
              },
              "name": {
                "$ref": "#/definitions/name"
              },
              "schema": {
                "$ref": "#/definitions/schema"
              },
              "title": {
                "$ref": "#/definitions/title"
              }
            },
            "required": [
              "kind",
              "title",
              "description",
              "hookGroupId",
              "hookId",
              "hookPayload"
            ],
            "type": "object"
          }
        ]
      },
      "type": "array",
      "uniqueItems": true
    },
    "variables": {
      "additionalProperties": true,
      "description": "Additional variables included in JSON-e context.\n",
      "type": "object"
    },
    "version": {
      "enum": [
        1
      ],
      "type": "integer"
    }
  },
  "required": [
    "version",
    "actions",
    "variables"
  ],
  "title": "Schema for Exposing Actions",
  "type": "object"
}