{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jimmykurian.github.io/ci-parity/schemas/config.schema.json",
  "title": "ci-parity configuration (.ci-parity.yml)",
  "description": "Every key is optional; a key set to null keeps its default. See https://jimmykurian.github.io/ci-parity/reference/configuration/",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "runner": {
      "description": "The task runner whose files are read.",
      "enum": [
        "taskfile",
        "make",
        "just",
        "mise",
        null
      ],
      "default": "taskfile"
    },
    "taskfile": {
      "description": "Path of the Taskfile, for runner taskfile only. Empty finds Taskfile.yml, taskfile.yml, Taskfile.yaml, taskfile.yaml, then the .dist variants.",
      "type": [
        "string",
        "null"
      ],
      "default": ""
    },
    "workflows": {
      "description": "Globs of the workflow and composite action files to check, repository-relative with forward slashes.",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string",
        "minLength": 1
      },
      "default": [
        ".github/workflows/*.yml",
        ".github/workflows/*.yaml",
        ".github/actions/**/action.yml",
        ".github/actions/**/action.yaml"
      ]
    },
    "invokers": {
      "description": "How CI calls the task runner.",
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "properties": {
        "shell": {
          "description": "Commands that run a task, such as task or go tool task.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "actions": {
          "description": "Local composite actions whose input names the task.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "uses",
              "input"
            ],
            "properties": {
              "uses": {
                "type": "string",
                "minLength": 1
              },
              "input": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      }
    },
    "tools": {
      "description": "Which commands count as tools. replace can't be combined with extend or remove.",
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "properties": {
        "extend": {
          "description": "Added to the built-in list.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "remove": {
          "description": "Removed from the built-in list.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "replace": {
          "description": "A non-empty list replaces the built-in list.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "if": {
        "properties": {
          "replace": {
            "type": "array",
            "minItems": 1
          }
        },
        "required": [
          "replace"
        ]
      },
      "then": {
        "properties": {
          "extend": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 0
          },
          "remove": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 0
          }
        }
      }
    },
    "transparent": {
      "description": "Wrappers that are looked through, such as sudo and env.",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string",
        "minLength": 1
      },
      "default": [
        "sudo",
        "env",
        "time",
        "nice",
        "ionice",
        "timeout",
        "nohup",
        "xvfb-run",
        "chronic"
      ]
    },
    "allow": {
      "description": "Inline commands to allow, each with a reason.",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "match",
          "reason"
        ],
        "properties": {
          "match": {
            "description": "Pattern matched against the whole command; * matches any characters.",
            "type": "string",
            "minLength": 1
          },
          "reason": {
            "description": "Why the command is allowed.",
            "type": "string",
            "minLength": 1
          },
          "workflows": {
            "description": "Globs of the workflows it applies to; all when empty.",
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    },
    "baseline": {
      "description": "Path of the baseline file.",
      "type": [
        "string",
        "null"
      ],
      "default": ".ci-parity-baseline.json"
    }
  },
  "if": {
    "properties": {
      "runner": {
        "enum": [
          "make",
          "just",
          "mise"
        ]
      }
    },
    "required": [
      "runner"
    ]
  },
  "then": {
    "properties": {
      "taskfile": {
        "anyOf": [
          {
            "type": "null"
          },
          {
            "const": ""
          }
        ]
      }
    }
  }
}
