Skip to content

ERROR: For 'anyOf/1', {"strict"=>true, "contexts"=>[], "checks"=>[]} is not a null. #12

@NiccoloFei

Description

@NiccoloFei

Hello,

Since last week approximately the script started failing with the following error:

npm WARN exec The following package was not found and will be installed: @octoherd/script-sync-branch-protections

Running @octoherd/cli v3.4.4 (@octoherd/octokit v2.3.1, Node.js: v16.13.0, linux x64)
 INFO  Loading repositories ...
.
 INFO  Running on <myorg>/<my_repo> ...
 INFO  branch protection settings loaded from <myorg>/<my_template_repo> {"required_status_checks":{"strict":true,"contexts":[],"checks":[]},"enforce_admins":true,"required_pull_request_reviews":{"dismiss_stale_reviews":false,"require_code_owner_reviews":true,"required_approving_review_count":2},"restrictions":null,"required_signatures":false,"required_linear_histor … }
 ERROR  HttpError: Invalid request.

No subschema in "anyOf" matched.
More than one subschema in "oneOf" matched.
Not all subschemas of "allOf" matched.
For 'anyOf/1', {"strict"=>true, "contexts"=>[], "checks"=>[]} is not a null.
    at /home/runner/.npm/_npx/9c37c62cde30630c/node_modules/@octokit/request/dist-node/index.js:86:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Job.doExecute (/home/runner/.npm/_npx/9c37c62cde30630c/node_modules/bottleneck/light.js:405:18) {"name":"HttpError","status":422,"response":{"url":"https://api.github.com/repos/<myorg>/<my_repo>/branches/main/protection","status":422,"headers":{"access-control-allow-origin":"*","access-control-expose-headers":"ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateL … }

This is the JSON of the template repo returned by the Github API (the one from the destination repository looks the same):

{
  "url": "https://api.github.com/repos/<myorg>/<my_template_repo>/branches/main/protection",
  "required_status_checks": {
    "url": "https://api.github.com/repos/<myorg>/<my_template_repo>/branches/main/protection/required_status_checks",
    "strict": true,
    "contexts": [],
    "contexts_url": "https://api.github.com/repos/<myorg>/<my_template_repo>/branches/main/protection/required_status_checks/contexts",
    "checks": []
  },
  "required_pull_request_reviews": {
    "url": "https://api.github.com/repos/<myorg>/<my_template_repo>/branches/main/protection/required_pull_request_reviews",
    "dismiss_stale_reviews": false,
    "require_code_owner_reviews": true,
    "required_approving_review_count": 2
  },
  "required_signatures": {
    "url": "https://api.github.com/repos/<myorg>/<my_template_repo>/branches/main/protection/required_signatures",
    "enabled": false
  },
  "enforce_admins": {
    "url": "https://api.github.com/repos/<myorg>/<my_template_repo>/branches/main/protection/enforce_admins",
    "enabled": true
  },
  "required_linear_history": {
    "enabled": true
  },
  "allow_force_pushes": {
    "enabled": false
  },
  "allow_deletions": {
    "enabled": false
  },
  "required_conversation_resolution": {
    "enabled": false
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions