-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevaluation-input.schema.json
More file actions
147 lines (147 loc) · 12.2 KB
/
Copy pathevaluation-input.schema.json
File metadata and controls
147 lines (147 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://patchgate.dev/schemas/evaluation-input/0.1",
"title": "PatchGate evaluation input",
"type": "object",
"additionalProperties": false,
"required": ["schemaVersion", "repository", "revisions", "policy", "policySources", "policyDigest", "changedPaths", "linkedIssues", "reviews", "checks", "ownershipRequirements", "observations"],
"properties": {
"schemaVersion": { "const": "0.1" },
"repository": { "$ref": "#/$defs/repository" },
"revisions": { "$ref": "#/$defs/revisions" },
"policy": { "anyOf": [{ "$ref": "https://patchgate.dev/schemas/patchgate-policy/0.1" }, { "type": "null" }] },
"policySources": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/policySource" } },
"policyDigest": { "$ref": "#/$defs/digest" },
"changedPaths": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/nonBlank" }, "uniqueItems": true },
"linkedIssues": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/linkedIssue" } },
"reviews": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/review" } },
"checks": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/check" } },
"ownershipRequirements": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/ownershipRequirement" } },
"nativeControls": { "$ref": "#/$defs/nativeControls" },
"reviewability": { "$ref": "#/$defs/reviewabilitySnapshot" },
"observations": { "$ref": "#/$defs/observations" }
},
"$defs": {
"nonBlank": { "type": "string", "minLength": 1, "pattern": ".*\\S.*", "maxLength": 100000 },
"digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
"timestamp": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$" },
"repository": {
"type": "object", "additionalProperties": false, "required": ["owner", "name", "pullRequest"],
"properties": { "owner": { "$ref": "#/$defs/nonBlank" }, "name": { "$ref": "#/$defs/nonBlank" }, "pullRequest": { "type": "integer", "minimum": 1 } }
},
"revisions": {
"type": "object", "additionalProperties": false, "required": ["baseSha", "headSha", "testedSha", "targetKind"],
"properties": {
"baseSha": { "$ref": "#/$defs/nonBlank" }, "headSha": { "$ref": "#/$defs/nonBlank" }, "mergeSha": { "$ref": "#/$defs/nonBlank" },
"mergeGroupSha": { "$ref": "#/$defs/nonBlank" }, "testedSha": { "$ref": "#/$defs/nonBlank" },
"targetKind": { "enum": ["head", "merge", "merge_group"] }
}
},
"policySource": {
"type": "object", "additionalProperties": false, "required": ["kind", "identity", "revision", "digest", "authority"],
"properties": {
"kind": { "enum": ["patchgate", "codeowners", "ruleset", "branch_protection"] }, "identity": { "$ref": "#/$defs/nonBlank" },
"revision": { "$ref": "#/$defs/nonBlank" }, "digest": { "$ref": "#/$defs/digest" }, "contractDigest": { "$ref": "#/$defs/digest" }, "authority": { "const": "enforced" }
}
},
"observationSource": {
"type": "object", "additionalProperties": false, "required": ["kind", "identity"],
"properties": { "kind": { "$ref": "#/$defs/nonBlank" }, "identity": { "$ref": "#/$defs/nonBlank" } }
},
"observationMeta": {
"type": "object", "additionalProperties": false, "required": ["source", "retrievedAt", "complete", "permissionState"],
"properties": {
"source": { "$ref": "#/$defs/observationSource" }, "revision": { "$ref": "#/$defs/nonBlank" }, "retrievedAt": { "$ref": "#/$defs/timestamp" },
"complete": { "type": "boolean" }, "permissionState": { "enum": ["sufficient", "insufficient", "unknown"] },
"normalizedDigest": { "$ref": "#/$defs/digest" }, "responseDigest": { "$ref": "#/$defs/digest" }, "truncated": { "type": "boolean" }, "nextCursor": { "$ref": "#/$defs/nonBlank" }
}
},
"observations": {
"type": "object", "additionalProperties": false, "required": ["policySources", "changedPaths", "linkedIssues", "reviews", "checks", "ownership", "reviewability"],
"properties": {
"policySources": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/observationMeta" } },
"changedPaths": { "$ref": "#/$defs/observationMeta" }, "linkedIssues": { "$ref": "#/$defs/observationMeta" }, "reviews": { "$ref": "#/$defs/observationMeta" },
"checks": { "$ref": "#/$defs/observationMeta" }, "ownership": { "$ref": "#/$defs/observationMeta" }, "reviewability": { "$ref": "#/$defs/observationMeta" }
}
},
"linkedIssue": {
"type": "object", "additionalProperties": false, "required": ["repository", "number", "repositoryId", "issueId", "linked"],
"properties": { "repository": { "$ref": "#/$defs/nonBlank" }, "number": { "type": "integer", "minimum": 1 }, "repositoryId": { "$ref": "#/$defs/nonBlank" }, "issueId": { "$ref": "#/$defs/nonBlank" }, "linked": { "type": "boolean" } }
},
"qualification": {
"type": "object", "additionalProperties": false, "required": ["source", "complete", "permissionState"],
"properties": {
"source": { "$ref": "#/$defs/observationSource" }, "revision": { "$ref": "#/$defs/nonBlank" }, "complete": { "type": "boolean" }, "permissionState": { "enum": ["sufficient", "insufficient", "unknown"] },
"principalBindings": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/qualificationPrincipal" }, "uniqueItems": true }
}
},
"qualificationPrincipal": {
"type": "object", "additionalProperties": false, "required": ["configuredPrincipal", "kind", "immutableId", "membershipState"],
"properties": { "configuredPrincipal": { "$ref": "#/$defs/nonBlank" }, "kind": { "enum": ["user", "team"] }, "immutableId": { "type": "integer", "minimum": 1 }, "membershipState": { "enum": ["active", "pending", "unknown"] } }
},
"review": {
"type": "object", "additionalProperties": false, "required": ["reviewId", "actorId", "login", "state", "commitId", "qualified", "teams", "teamIds", "qualification", "isAuthor", "isBot", "active"],
"properties": {
"reviewId": { "type": "integer", "minimum": 1 }, "actorId": { "type": "integer", "minimum": 1 }, "login": { "$ref": "#/$defs/nonBlank" },
"state": { "enum": ["APPROVED", "CHANGES_REQUESTED", "COMMENTED", "DISMISSED"] }, "commitId": { "$ref": "#/$defs/nonBlank" }, "qualified": { "type": "boolean" },
"teams": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/nonBlank" }, "uniqueItems": true }, "teamIds": { "type": "array", "maxItems": 3000, "items": { "type": "integer", "minimum": 1 }, "uniqueItems": true },
"qualification": { "$ref": "#/$defs/qualification" }, "isAuthor": { "type": "boolean" }, "isBot": { "type": "boolean" }, "active": { "type": "boolean" }
}
},
"check": {
"type": "object", "additionalProperties": false, "required": ["name", "status", "testedSha", "sourceStrength", "retrievedAt"],
"allOf": [
{ "if": { "properties": { "status": { "const": "completed" } }, "required": ["status"] }, "then": { "properties": { "conclusion": { "$ref": "#/$defs/nonBlank" } }, "required": ["conclusion"] } },
{ "if": { "properties": { "sourceStrength": { "const": "github_app_expected" } }, "required": ["sourceStrength"] }, "then": { "properties": { "appId": { "type": "integer", "minimum": 1 }, "checkRunId": { "type": "integer", "minimum": 1 } }, "required": ["appId", "checkRunId"] } },
{ "if": { "properties": { "sourceStrength": { "const": "github_actions_workflow" } }, "required": ["sourceStrength"] }, "then": { "properties": { "appId": { "type": "integer", "minimum": 1 }, "workflowRunId": { "type": "integer", "minimum": 1 }, "workflowRunAttempt": { "type": "integer", "minimum": 1 }, "event": { "$ref": "#/$defs/nonBlank" } }, "required": ["appId", "workflowRunId", "workflowRunAttempt", "event"] } }
],
"properties": {
"name": { "$ref": "#/$defs/nonBlank" }, "status": { "enum": ["queued", "in_progress", "completed"] }, "conclusion": { "$ref": "#/$defs/nonBlank" }, "testedSha": { "$ref": "#/$defs/nonBlank" },
"appSlug": { "$ref": "#/$defs/nonBlank" }, "appId": { "type": "integer", "minimum": 1 }, "checkRunId": { "type": "integer", "minimum": 1 }, "checkSuiteId": { "type": "integer", "minimum": 1 }, "workflowId": { "type": "integer", "minimum": 1 },
"workflowPath": { "$ref": "#/$defs/nonBlank" }, "workflowRunId": { "type": "integer", "minimum": 1 }, "workflowRunAttempt": { "type": "integer", "minimum": 1 }, "event": { "$ref": "#/$defs/nonBlank" },
"sourceStrength": { "enum": ["github_app_expected", "github_actions_workflow", "unattributed"] }, "retrievedAt": { "$ref": "#/$defs/timestamp" }
}
},
"ownershipRequirement": {
"type": "object", "additionalProperties": false, "required": ["id", "owners", "requiredCount"],
"properties": { "id": { "$ref": "#/$defs/nonBlank" }, "owners": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/nonBlank" }, "uniqueItems": true }, "requiredCount": { "type": "integer", "minimum": 1 } }
},
"nativeBranchProtectionCheck": {
"type": "object", "additionalProperties": false, "required": ["context"],
"properties": { "context": { "$ref": "#/$defs/nonBlank" }, "appId": { "type": "integer", "minimum": 1 } }
},
"nativeBranchProtection": {
"type": "object", "additionalProperties": false,
"required": ["requiredChecks", "requiredApprovals", "requireCodeOwnerReviews", "requireLastPushApproval", "staleReviews", "requiredReviewThreadResolution", "bypassVisible", "decisionBearing"],
"properties": {
"requiredChecks": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/nativeBranchProtectionCheck" }, "uniqueItems": true },
"requiredApprovals": { "type": "integer", "minimum": 0 },
"requireCodeOwnerReviews": { "type": "boolean" },
"requireLastPushApproval": { "type": "boolean" },
"staleReviews": { "type": "boolean" },
"requiredReviewThreadResolution": { "type": "boolean" },
"bypassVisible": { "type": "boolean" },
"decisionBearing": { "type": "boolean" }
}
},
"nativeRuleset": {
"type": "object", "additionalProperties": false,
"required": ["id", "name", "sourceType", "source", "enforcement", "applicable", "ruleTypes", "requiredChecks", "requiredApprovals", "requireCodeOwnerReviews", "requireLastPushApproval", "staleReviews", "requiredReviewThreadResolution", "bypassVisible", "decisionBearing"],
"properties": {
"id": { "type": "integer", "minimum": 1 }, "name": { "$ref": "#/$defs/nonBlank" }, "sourceType": { "$ref": "#/$defs/nonBlank" }, "source": { "$ref": "#/$defs/nonBlank" },
"enforcement": { "enum": ["active", "evaluate", "disabled", "unknown"] }, "applicable": { "type": "boolean" },
"ruleTypes": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/nonBlank" }, "uniqueItems": true },
"requiredChecks": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/nativeBranchProtectionCheck" }, "uniqueItems": true },
"requiredApprovals": { "type": "integer", "minimum": 0 }, "requireCodeOwnerReviews": { "type": "boolean" }, "requireLastPushApproval": { "type": "boolean" }, "staleReviews": { "type": "boolean" }, "requiredReviewThreadResolution": { "type": "boolean" }, "bypassVisible": { "type": "boolean" }, "decisionBearing": { "type": "boolean" }
}
},
"nativeControls": {
"type": "object", "additionalProperties": false,
"properties": { "branchProtection": { "$ref": "#/$defs/nativeBranchProtection" }, "rulesets": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/nativeRuleset" }, "uniqueItems": true } }
},
"reviewabilitySnapshot": {
"type": "object", "additionalProperties": false, "required": ["fileCount", "ownershipDomains", "generatedFileCount", "boundaryCount"],
"properties": { "fileCount": { "type": "integer", "minimum": 0 }, "ownershipDomains": { "type": "array", "maxItems": 3000, "items": { "$ref": "#/$defs/nonBlank" }, "uniqueItems": true }, "generatedFileCount": { "type": "integer", "minimum": 0 }, "boundaryCount": { "type": "integer", "minimum": 0 } }
}
}
}