# org.tangled.ci.defs

> Published by [tangled.org](https://lexicon.garden/identity/did:plc:wshs7t2adsemcrrd4snkeqli)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:wshs7t2adsemcrrd4snkeqli/org.tangled.ci.defs)
- [Documentation](https://lexicon.garden/lexicon/did:plc:wshs7t2adsemcrrd4snkeqli/org.tangled.ci.defs/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:wshs7t2adsemcrrd4snkeqli/org.tangled.ci.defs/examples)

## Definitions

### `org.tangled.ci.defs#externalSource`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `link` | `string` (uri) | Yes |  |
| `name` | `string` | No | human-readable name of external source |

### `org.tangled.ci.defs#fileSource`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `commit` | `string` | Yes |  |
| `lines` | `ref` → `#lineRange` | No |  |
| `path` | `string` | Yes |  |
| `repo` | `string` (did) | Yes |  |

### `org.tangled.ci.defs#lineRange`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `end` | `integer` | Yes |  |
| `start` | `integer` | Yes |  |

### `org.tangled.ci.defs#pipeline`

**Type**: `object`

A CI pipeline. Record-like, but owned by the spindle rather than a PDS.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `commit` | `string` | Yes | Commit Id this pipeline is running on |
| `createdAt` | `string` (datetime) | No |  |
| `id` | `string` (record-key) | Yes | Spindle-local pipeline id |
| `repo` | `string` (did) | Yes | Repository DID |
| `sourceRepo` | `string` (did) | No | Repository DID that the commit was checked out from, if different from repo (e.g. a fork for a fork-based pull request) |
| `trigger` | `union` | Yes | Trigger event that triggered this pipeline. |
| `workflows` | `array` | Yes | Triggered workflows |

### `org.tangled.ci.defs#workflow`

**Type**: `object`

A workflow definition

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `hash` | `string` | No | Fingerprint of the workflow definition as resolved by the spindle. |
| `id` | `string` | Yes |  |
| `name` | `string` | No | Human-readable name of the workflow |
| `source` | `union` | Yes |  |
| `triggers` | `array` | Yes | Event types that triggers this workflow. |

### `org.tangled.ci.defs#workflowRun`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `definition` | `ref` → `#workflow` | Yes | Workflow definition where this workflow run is originated from. |
| `error` | `string` | No |  |
| `finishedAt` | `string` (datetime) | No |  |
| `id` | `string` | Yes | Pipeline-local workflow id, usually same as name. |
| `name` | `string` | No | Human-readable name of the workflow |
| `startedAt` | `string` (datetime) | No |  |
| `status` | `string` | Yes | Workflow status |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "externalSource": {
      "properties": {
        "link": {
          "format": "uri",
          "type": "string"
        },
        "name": {
          "description": "human-readable name of external source",
          "type": "string"
        }
      },
      "required": [
        "link"
      ],
      "type": "object"
    },
    "fileSource": {
      "properties": {
        "commit": {
          "maxLength": 128,
          "minLength": 40,
          "type": "string"
        },
        "lines": {
          "ref": "#lineRange",
          "type": "ref"
        },
        "path": {
          "minLength": 1,
          "type": "string"
        },
        "repo": {
          "format": "did",
          "type": "string"
        }
      },
      "required": [
        "repo",
        "commit",
        "path"
      ],
      "type": "object"
    },
    "lineRange": {
      "properties": {
        "end": {
          "minimum": 1,
          "type": "integer"
        },
        "start": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "start",
        "end"
      ],
      "type": "object"
    },
    "pipeline": {
      "description": "A CI pipeline. Record-like, but owned by the spindle rather than a PDS.",
      "properties": {
        "commit": {
          "description": "Commit Id this pipeline is running on",
          "type": "string"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "id": {
          "description": "Spindle-local pipeline id",
          "format": "record-key",
          "type": "string"
        },
        "repo": {
          "description": "Repository DID",
          "format": "did",
          "type": "string"
        },
        "sourceRepo": {
          "description": "Repository DID that the commit was checked out from, if different from repo (e.g. a fork for a fork-based pull request)",
          "format": "did",
          "type": "string"
        },
        "trigger": {
          "closed": false,
          "description": "Trigger event that triggered this pipeline.",
          "refs": [
            "org.tangled.event.push",
            "org.tangled.event.pullRequest",
            "org.tangled.ci.trigger.manual",
            "org.tangled.ci.trigger.schedule"
          ],
          "type": "union"
        },
        "workflows": {
          "description": "Triggered workflows",
          "items": {
            "ref": "#workflowRun",
            "type": "ref"
          },
          "maxLength": 50,
          "minLength": 1,
          "type": "array"
        }
      },
      "required": [
        "id",
        "repo",
        "trigger",
        "commit",
        "workflows"
      ],
      "type": "object"
    },
    "workflow": {
      "description": "A workflow definition",
      "properties": {
        "hash": {
          "description": "Fingerprint of the workflow definition as resolved by the spindle.",
          "type": "string"
        },
        "id": {
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        },
        "name": {
          "description": "Human-readable name of the workflow",
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        },
        "source": {
          "refs": [
            "#fileSource",
            "#externalSource"
          ],
          "type": "union"
        },
        "triggers": {
          "description": "Event types that triggers this workflow.",
          "items": {
            "knownValues": [
              "org.tangled.event.push",
              "org.tangled.event.pullRequest",
              "org.tangled.ci.trigger.manual",
              "org.tangled.ci.trigger.schedule"
            ],
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "id",
        "source",
        "triggers"
      ],
      "type": "object"
    },
    "workflowRun": {
      "properties": {
        "definition": {
          "description": "Workflow definition where this workflow run is originated from.",
          "ref": "#workflow",
          "type": "ref"
        },
        "error": {
          "type": "string"
        },
        "finishedAt": {
          "format": "datetime",
          "type": "string"
        },
        "id": {
          "description": "Pipeline-local workflow id, usually same as name.",
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        },
        "name": {
          "description": "Human-readable name of the workflow",
          "maxLength": 128,
          "type": "string"
        },
        "startedAt": {
          "format": "datetime",
          "type": "string"
        },
        "status": {
          "description": "Workflow status",
          "enum": [
            "pending",
            "blocked",
            "running",
            "failed",
            "timeout",
            "cancelled",
            "success"
          ],
          "type": "string"
        }
      },
      "required": [
        "definition",
        "id",
        "status"
      ],
      "type": "object"
    }
  },
  "id": "org.tangled.ci.defs",
  "lexicon": 1
}
```
