Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes object has 19 possible keys but type is defined with only 3 of them #689

Closed
LightningStairs opened this issue Aug 9, 2022 · 5 comments
Labels
Type: Bug Something isn't working as documented

Comments

@LightningStairs
Copy link

The changes object type is defined to have 3 possible keys: authorized_actors_only, authorized_actor_names, and required_status_checks. But it can have several others as well:

     pull_request_reviews_enforcement_level
      required_approving_review_count
      dismiss_stale_reviews_on_push
      require_code_owner_review
      authorized_dismissal_actors_only
      ignore_approvals_from_contributors
      required_status_checks_enforcement_level
      strict_required_status_checks_policy
      signature_requirement_enforcement_level
      linear_history_requirement_enforcement_level
      admin_enforced
      allow_force_pushes_enforcement_level
      allow_deletions_enforcement_level
      merge_queue_enforcement_level
      required_deployments_enforcement_level
      required_conversation_resolution_level

Because of how this type is defined it is only possible to test cases when authorized_actors_only, authorized_actor_names, and required_status_checks change.

changes: {
authorized_actors_only?: {
from: boolean;
};
authorized_actor_names?: {
from: string[];
};
required_status_checks?: {
from: string[];
};
};

@wolfy1339 wolfy1339 added the Type: Bug Something isn't working as documented label Aug 9, 2022
@wolfy1339
Copy link
Member

Can you confirm wether this is for GitHub.com and not GitHub.AE or GitHub Enterprise?
Please provide an example payload with those keys

wolfy1339 added a commit that referenced this issue Aug 9, 2022
…dited`, add missing keys to `changes` property in `branch_protection_rule#edited`, new `blocking` permission for apps (#690)

Fixes #688
Fixes part of #689
@JamieMagee
Copy link

The required_conversation_resolution_level now has a different type in the BranchProtectionRule

required_conversation_resolution_level: "off" | "non_admins" | "everyone";

and BranchProtectionRuleEditedEvent

required_conversation_resolution_level?: {
from: "off" | "required" | "requested_and_required";
};

@wolfy1339
Copy link
Member

I think it might be easiest to introduce a new common schema for each rule type.

  • BranchProtectionRuleBinary - rules where only boolean values are used
  • BranchProtectionRuleMultiLevel - rules where you can select one of off, non_admins, or everyone
  • BranchProtectionRuleArray - rules where an array of strings is expected, used for actor and build rules

@JamieMagee
Copy link

That sounds reasonable, and it's effectively what I did in the .NET version. I think you will also need a BranchProtectionRuleNumber as well though:

required_approving_review_count: number;

@wolfy1339
Copy link
Member

I believe all the remaining possible keys have been added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

3 participants