Skip to content

Commit

Permalink
fix: changes property can be undefined in `branch_protection_rule#e…
Browse files Browse the repository at this point in the history
…dited`, add missing keys to `changes` property in `branch_protection_rule#edited`, new `blocking` permission for apps (#690)

Fixes #688
Fixes part of #689
  • Loading branch information
wolfy1339 authored Aug 9, 2022
1 parent c2d5c3c commit 3926e99
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@
},
"changes": {
"authorized_actors_only": { "from": false },
"authorized_actor_names": { "from": [] }
"authorized_actor_names": { "from": [] },
"authorized_dismissal_actors_only": { "from": null },
"linear_history_requirement_enforcement_level": { "from": "everyone" },
"required_approving_review_count": { "from": 2 },
"dismiss_stale_reviews_on_push": { "from": true },
"require_code_owner_review": { "from": true },
"allow_force_pushes_enforcement_level": { "from": "everyone" },
"required_deployments_enforcement_level": { "from": "off" },
"pull_request_reviews_enforcement_level": { "from": "off" },
"required_status_checks_enforcement_level": { "from": "off" },
"signature_requirement_enforcement_level": { "from": "non_admins" },
"admin_enforced": { "from": false },
"allow_deletions_enforcement_level": { "from": "off" },
"required_conversation_resolution_level": { "from": "off" }
},
"repository": {
"id": 17273051,
Expand Down
17 changes: 16 additions & 1 deletion payload-examples/api.github.com/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,22 @@
},
"changes": {
"authorized_actors_only": { "from": false },
"authorized_actor_names": { "from": [] }
"authorized_actor_names": { "from": [] },
"authorized_dismissal_actors_only": { "from": null },
"linear_history_requirement_enforcement_level": {
"from": "everyone"
},
"required_approving_review_count": { "from": 2 },
"dismiss_stale_reviews_on_push": { "from": true },
"require_code_owner_review": { "from": true },
"allow_force_pushes_enforcement_level": { "from": "everyone" },
"required_deployments_enforcement_level": { "from": "off" },
"pull_request_reviews_enforcement_level": { "from": "off" },
"required_status_checks_enforcement_level": { "from": "off" },
"signature_requirement_enforcement_level": { "from": "non_admins" },
"admin_enforced": { "from": false },
"allow_deletions_enforcement_level": { "from": "off" },
"required_conversation_resolution_level": { "from": "off" }
},
"repository": {
"id": 17273051,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,42 @@
"$id": "branch_protection_rule$edited",
"type": "object",
"description": "Activity related to a branch protection rule. For more information, see \"[About branch protection rules](https://docs.github.com/en/github/administering-a-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#about-branch-protection-rules).\"",
"required": ["action", "rule", "changes", "repository", "sender"],
"required": ["action", "rule", "repository", "sender"],
"properties": {
"action": { "type": "string", "enum": ["edited"] },
"rule": { "$ref": "common/branch-protection-rule.schema.json" },
"changes": {
"type": "object",
"description": "If the action was `edited`, the changes to the rule.",
"properties": {
"admin_enforced": {
"type": "object",
"required": ["from"],
"properties": { "from": { "type": "boolean" } },
"additionalProperties": false
},
"allow_deletions_enforcement_level": {
"type": "object",
"required": ["from"],
"properties": {
"from": {
"type": ["string", "null"],
"enum": ["off", "non_admins", "everyone"]
}
},
"additionalProperties": false
},
"allow_force_pushes_enforcement_level": {
"type": "object",
"required": ["from"],
"properties": {
"from": {
"type": "string",
"enum": ["off", "non_admins", "everyone"]
}
},
"additionalProperties": false
},
"authorized_actors_only": {
"type": "object",
"required": ["from"],
Expand All @@ -25,13 +53,103 @@
},
"additionalProperties": false
},
"authorized_dismissal_actors_only": {
"type": "object",
"required": ["from"],
"properties": { "from": { "type": ["boolean", "null"] } },
"additionalProperties": false
},
"dismiss_stale_reviews_on_push": {
"type": "object",
"required": ["from"],
"properties": { "from": { "type": "boolean" } },
"additionalProperties": false
},
"pull_request_reviews_enforcement_level": {
"type": "object",
"required": ["from"],
"properties": {
"from": {
"type": "string",
"enum": ["off", "non_admins", "everyone"]
}
},
"additionalProperties": false
},
"require_code_owner_review": {
"type": "object",
"required": ["from"],
"properties": { "from": { "type": ["boolean"] } },
"additionalProperties": false
},
"required_approving_review_count": {
"type": "object",
"required": ["from"],
"properties": { "from": { "type": "integer" } },
"additionalProperties": false
},
"required_conversation_resolution_level": {
"type": "object",
"required": ["from"],
"properties": {
"from": {
"type": "string",
"enum": ["off", "required", "requested_and_required"]
}
},
"additionalProperties": false
},
"required_deployments_enforcement_level": {
"type": "object",
"required": ["from"],
"properties": {
"from": {
"type": "string",
"enum": ["off", "non_admins", "everyone"]
}
},
"additionalProperties": false
},
"required_status_checks": {
"type": "object",
"required": ["from"],
"properties": {
"from": { "type": "array", "items": { "type": "string" } }
},
"additionalProperties": false
},
"required_status_checks_enforcement_level": {
"type": "object",
"required": ["from"],
"properties": {
"from": {
"type": "string",
"enum": ["off", "non_admins", "everyone"]
}
},
"additionalProperties": false
},
"signature_requirement_enforcement_level": {
"type": "object",
"required": ["from"],
"properties": {
"from": {
"type": "string",
"enum": ["off", "non_admins", "everyone"]
}
},
"additionalProperties": false
},
"linear_history_requirement_enforcement_level": {
"type": "object",
"required": ["from"],
"properties": {
"from": {
"type": "string",
"enum": ["off", "non_admins", "everyone"]
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down
1 change: 1 addition & 0 deletions payload-schemas/api.github.com/common/app.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"properties": {
"actions": { "type": "string", "enum": ["read", "write"] },
"administration": { "type": "string", "enum": ["read", "write"] },
"blocking": { "type": "string", "enum": ["read", "write"] },
"checks": { "type": "string", "enum": ["read", "write"] },
"content_references": { "type": "string", "enum": ["read", "write"] },
"contents": { "type": "string", "enum": ["read", "write"] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"enum": ["read", "write"],
"description": "The level of permission granted to the access token for repository creation, deletion, settings, teams, and collaborators creation."
},
"blocking": { "type": "string", "enum": ["read", "write"] },
"checks": {
"type": "string",
"enum": ["read", "write"],
Expand Down
43 changes: 42 additions & 1 deletion payload-types/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -790,16 +790,55 @@ export interface BranchProtectionRuleEditedEvent {
/**
* If the action was `edited`, the changes to the rule.
*/
changes: {
changes?: {
admin_enforced?: {
from: boolean;
};
allow_deletions_enforcement_level?: {
from: ("off" | "non_admins" | "everyone") | null;
};
allow_force_pushes_enforcement_level?: {
from: "off" | "non_admins" | "everyone";
};
authorized_actors_only?: {
from: boolean;
};
authorized_actor_names?: {
from: string[];
};
authorized_dismissal_actors_only?: {
from: boolean | null;
};
dismiss_stale_reviews_on_push?: {
from: boolean;
};
pull_request_reviews_enforcement_level?: {
from: "off" | "non_admins" | "everyone";
};
require_code_owner_review?: {
from: boolean;
};
required_approving_review_count?: {
from: number;
};
required_conversation_resolution_level?: {
from: "off" | "required" | "requested_and_required";
};
required_deployments_enforcement_level?: {
from: "off" | "non_admins" | "everyone";
};
required_status_checks?: {
from: string[];
};
required_status_checks_enforcement_level?: {
from: "off" | "non_admins" | "everyone";
};
signature_requirement_enforcement_level?: {
from: "off" | "non_admins" | "everyone";
};
linear_history_requirement_enforcement_level?: {
from: "off" | "non_admins" | "everyone";
};
};
repository: Repository;
sender: User;
Expand Down Expand Up @@ -982,6 +1021,7 @@ export interface App {
permissions?: {
actions?: "read" | "write";
administration?: "read" | "write";
blocking?: "read" | "write";
checks?: "read" | "write";
content_references?: "read" | "write";
contents?: "read" | "write";
Expand Down Expand Up @@ -2900,6 +2940,7 @@ export interface Installation {
* The level of permission granted to the access token for repository creation, deletion, settings, teams, and collaborators creation.
*/
administration?: "read" | "write";
blocking?: "read" | "write";
/**
* The level of permission granted to the access token for checks on code.
*/
Expand Down

0 comments on commit 3926e99

Please sign in to comment.