{
  "openapi": "3.1.0",
  "info": {
    "title": "GBB Platform API",
    "version": "1.0.0",
    "description": "Compatibility authority for the CLI's additive public contract. Operations use /api/v1 unless an operation-level server identifies a Better Auth route outside that prefix. Breaking field, enum, error, pagination, idempotency, or auth non-disclosure changes require a new API version. Deprecations remain for at least 12 months and two stable minor CLI releases, whichever is longer."
  },
  "servers": [
    {
      "url": "/api/v1"
    }
  ],
  "x-cli-operation-inventory": [
    "GET /user",
    "POST /auth/device/code",
    "POST /auth/device/token",
    "POST /auth/device/cancel",
    "POST /auth/refresh",
    "POST /auth/revoke",
    "POST /repos/{owner}/{repo}/git/credentials",
    "GET /repos/{owner}/{repo}",
    "POST /user/repos",
    "POST /orgs/{owner}/repos",
    "GET /repos/{owner}/{repo}/issues",
    "POST /repos/{owner}/{repo}/issues",
    "GET /repos/{owner}/{repo}/issues/{number}",
    "PATCH /repos/{owner}/{repo}/issues/{number}",
    "PUT /repos/{owner}/{repo}/issues/{number}/labels/{labelId}",
    "DELETE /repos/{owner}/{repo}/issues/{number}/labels/{labelId}",
    "GET /repos/{owner}/{repo}/labels",
    "POST /repos/{owner}/{repo}/labels",
    "PATCH /repos/{owner}/{repo}/labels/{labelId}",
    "DELETE /repos/{owner}/{repo}/labels/{labelId}",
    "GET /repos/{owner}/{repo}/pulls",
    "POST /repos/{owner}/{repo}/pulls",
    "GET /repos/{owner}/{repo}/pulls/{number}",
    "PATCH /repos/{owner}/{repo}/pulls/{number}",
    "GET /repos/{owner}/{repo}/pulls/{number}/reviews",
    "POST /repos/{owner}/{repo}/pulls/{number}/reviews",
    "POST /repos/{owner}/{repo}/pulls/{number}/update-branch",
    "PUT /repos/{owner}/{repo}/pulls/{number}/merge",
    "PUT /repos/{owner}/{repo}/pulls/{number}/labels/{labelId}",
    "DELETE /repos/{owner}/{repo}/pulls/{number}/labels/{labelId}",
    "GET /repos/{owner}/{repo}/checks",
    "GET /repos/{owner}/{repo}/check-runs/{runId}",
    "GET /repos/{owner}/{repo}/actions/workflows",
    "GET /repos/{owner}/{repo}/actions/workflows/{workflowId}",
    "POST /repos/{owner}/{repo}/actions/workflows/{workflowId}/dispatches",
    "GET /repos/{owner}/{repo}/actions/runs",
    "GET /repos/{owner}/{repo}/actions/runs/{runId}",
    "POST /repos/{owner}/{repo}/actions/runs/{runId}/cancel",
    "POST /repos/{owner}/{repo}/actions/runs/{runId}/rerun",
    "POST /repos/{owner}/{repo}/actions/environments/{environmentId}/secrets/imports"
  ],
  "paths": {
    "/user": {
      "get": {
        "operationId": "getAuthenticatedUser",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Authenticated account identity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/auth/device/code": {
      "post": {
        "operationId": "beginDeviceAuthorization",
        "servers": [
          {
            "url": "/api"
          }
        ],
        "x-better-auth-route": "/api/auth/device/code",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceCodeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Device authorization created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceCodeResponse"
                },
                "examples": {
                  "contract": {
                    "summary": "Contract fixture",
                    "value": {
                      "device_code": "device-code-redacted-contract-value-000000000000",
                      "user_code": "ABCD-EFGH",
                      "verification_uri": "https://git.example.com/device",
                      "verification_uri_complete": "https://git.example.com/device?user_code=ABCD-EFGH",
                      "expires_in": 600,
                      "interval": 5
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Better Auth rejected the device authorization request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/auth/device/token": {
      "post": {
        "operationId": "pollDeviceAuthorization",
        "x-in-app-route": "/api/v1/auth/device/token",
        "requestBody": {
          "$ref": "#/components/requestBodies/DeviceTokenExchange"
        },
        "responses": {
          "200": {
            "description": "Poll state or issued credential",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DevicePoll"
                },
                "examples": {
                  "pending": {
                    "summary": "Authorization pending",
                    "value": {
                      "state": "authorization_pending",
                      "interval": 5
                    }
                  },
                  "slowDown": {
                    "summary": "Client polled before the instructed interval",
                    "value": {
                      "state": "slow_down",
                      "interval": 10
                    }
                  },
                  "authorized": {
                    "summary": "Scoped CLI credential issued",
                    "value": {
                      "state": "authorized",
                      "credential": {
                        "credential_id": "cli-credential-contract-id",
                        "access_token": "gbb_at_contract_fixture_not_a_credential",
                        "refresh_token": "gbb_rt_contract_fixture_not_a_credential",
                        "expires_in": 3600,
                        "refresh_expires_in": 2592000,
                        "access_expires_at": 1788152400,
                        "refresh_expires_at": 1790740800,
                        "scopes": [
                          "identity.read",
                          "repo.read"
                        ],
                        "account": {
                          "id": "user-contract-id",
                          "login": "octocat",
                          "display_name": "Octo Cat"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The device-token request or grant is invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/auth/device/cancel": {
      "post": {
        "operationId": "cancelDeviceAuthorization",
        "x-in-app-route": "/api/v1/auth/device/cancel",
        "requestBody": {
          "$ref": "#/components/requestBodies/DeviceCancellation"
        },
        "responses": {
          "204": {
            "$ref": "#/components/responses/NoContent"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/auth/refresh": {
      "post": {
        "operationId": "refreshCredential",
        "x-in-app-route": "/api/v1/auth/refresh",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "refresh_token",
                  "request_id"
                ],
                "properties": {
                  "refresh_token": {
                    "type": "string",
                    "pattern": "^gbb_rt_"
                  },
                  "request_id": {
                    "type": "string",
                    "pattern": "^gbb_refresh_[a-f0-9]{64}$",
                    "description": "High-entropy nonce reused only when retrying this exact refresh attempt after an ambiguous response."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rotated credential pair",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CredentialEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "The refresh credential is invalid, expired, or already rotated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/auth/revoke": {
      "post": {
        "operationId": "revokeCredential",
        "x-in-app-route": "/api/v1/auth/revoke",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "access_token"
                    ]
                  },
                  {
                    "required": [
                      "refresh_token"
                    ]
                  }
                ],
                "properties": {
                  "access_token": {
                    "type": "string",
                    "pattern": "^gbb_at_"
                  },
                  "refresh_token": {
                    "type": "string",
                    "pattern": "^gbb_rt_",
                    "description": "Preferred family credential so revoke still works after access expiry."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "$ref": "#/components/responses/NoContent"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/git/credentials": {
      "post": {
        "operationId": "mintRepositoryGitCredential",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-max-authentication-uses": 16,
        "x-max-lifetime-seconds": 300,
        "x-max-live-grants-per-parent": 32,
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "operation"
                ],
                "properties": {
                  "operation": {
                    "type": "string",
                    "enum": [
                      "clone",
                      "fetch",
                      "push"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Repository- and operation-bound Git credential with a five-minute and 16-use ceiling",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GitCredentialEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "The parent credential already has the maximum number of live Git grants.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 300
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        }
      ],
      "get": {
        "operationId": "getRepository",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Repository detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepositoryEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/user/repos": {
      "post": {
        "operationId": "createUserRepository",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/CreateRepository"
        },
        "responses": {
          "201": {
            "description": "Repository created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepositoryEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orgs/{owner}/repos": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        }
      ],
      "post": {
        "operationId": "createOrganizationRepository",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/CreateRepository"
        },
        "responses": {
          "201": {
            "description": "Repository created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepositoryEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/issues": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        }
      ],
      "get": {
        "operationId": "listRepositoryIssues",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IssueState"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Issue list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueList"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createRepositoryIssue",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/CreateIssue"
        },
        "responses": {
          "201": {
            "description": "Issue created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/issues/{number}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/Number"
        }
      ],
      "get": {
        "operationId": "getRepositoryIssue",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Issue detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateRepositoryIssue",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/UpdateIssue"
        },
        "responses": {
          "200": {
            "description": "Issue updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IssueEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/issues/{number}/labels/{labelId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/Number"
        },
        {
          "$ref": "#/components/parameters/LabelId"
        }
      ],
      "put": {
        "operationId": "addIssueLabel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Label attached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "removeIssueLabel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Label removed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/labels": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        }
      ],
      "get": {
        "operationId": "listRepositoryLabels",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Label list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelList"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createRepositoryLabel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/WriteLabel"
        },
        "responses": {
          "201": {
            "description": "Label created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/labels/{labelId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/LabelId"
        }
      ],
      "patch": {
        "operationId": "updateRepositoryLabel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/UpdateLabel"
        },
        "responses": {
          "200": {
            "description": "Label updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteRepositoryLabel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted label",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        }
      ],
      "get": {
        "operationId": "listRepositoryPullRequests",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PullRequestState"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Pull request list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PullRequestList"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createRepositoryPullRequest",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/CreatePullRequest"
        },
        "responses": {
          "201": {
            "description": "Pull request created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PullRequestSummaryEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{number}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/Number"
        }
      ],
      "get": {
        "operationId": "getRepositoryPullRequest",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Pull request detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PullRequestEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "updateRepositoryPullRequest",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/UpdatePullRequest"
        },
        "responses": {
          "200": {
            "description": "Pull request updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PullRequestEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{number}/reviews": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/Number"
        }
      ],
      "get": {
        "operationId": "listPullRequestReviews",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Review list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewList"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "createPullRequestReview",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/CreateReview"
        },
        "responses": {
          "200": {
            "description": "Idempotent review replay",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewEnvelope"
                }
              }
            }
          },
          "201": {
            "description": "Review created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReviewEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{number}/update-branch": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/Number"
        }
      ],
      "post": {
        "operationId": "updatePullRequestBranch",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OptionalIdempotencyKey"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/UpdatePullRequestBranch"
        },
        "responses": {
          "200": {
            "description": "Branch updated, or the prior completed update replayed for the same optional idempotency key.",
            "headers": {
              "Idempotency-Replayed": {
                "description": "Present with `true` when this response replays a completed request using the same Idempotency-Key.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PullRequestBranchUpdateEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The pull request changed, the idempotency key was reused with different input, or the same-key request is still being reconciled.",
            "headers": {
              "Retry-After": {
                "description": "Present when the same-key request is still being reconciled.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "1"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "503": {
            "description": "The same-key request is still running and its distributed idempotency lock could not be acquired before the retry deadline.",
            "headers": {
              "Retry-After": {
                "description": "Always `1` for this retryable idempotency-lock response.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "1"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{number}/merge": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/Number"
        }
      ],
      "put": {
        "operationId": "mergePullRequest",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/MergePullRequest"
        },
        "responses": {
          "200": {
            "description": "Merge result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PullRequestEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls/{number}/labels/{labelId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/Number"
        },
        {
          "$ref": "#/components/parameters/LabelId"
        }
      ],
      "put": {
        "operationId": "addPullRequestLabel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Label attached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "removePullRequestLabel",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Label removed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabelEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/checks": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        }
      ],
      "get": {
        "operationId": "listRepositoryChecks",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "ref",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Check summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckSummary"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/check-runs/{runId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "getRepositoryCheckRun",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Check-run detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckRunEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/actions/workflows": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        }
      ],
      "get": {
        "operationId": "listRepositoryWorkflows",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "Workflow list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowList"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/actions/workflows/{workflowId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/WorkflowId"
        }
      ],
      "get": {
        "operationId": "getRepositoryWorkflow",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Workflow detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Workflow"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/actions/workflows/{workflowId}/dispatches": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/WorkflowId"
        }
      ],
      "post": {
        "operationId": "dispatchRepositoryWorkflow",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/DispatchWorkflow"
        },
        "responses": {
          "200": {
            "description": "Workflow dispatched",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunMutationEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/actions/runs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        }
      ],
      "get": {
        "operationId": "listRepositoryWorkflowRuns",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/PerPage"
          },
          {
            "$ref": "#/components/parameters/WorkflowRunStatus"
          },
          {
            "name": "branch",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          {
            "name": "event",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "head_sha",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Workflow run list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunList"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/actions/runs/{runId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "operationId": "getRepositoryWorkflowRun",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Workflow run detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRun"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/actions/runs/{runId}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "post": {
        "operationId": "cancelRepositoryWorkflowRun",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/WorkflowRunMutation"
        },
        "responses": {
          "200": {
            "description": "Cancellation accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/actions/runs/{runId}/rerun": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "post": {
        "operationId": "rerunRepositoryWorkflowRun",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/WorkflowRunMutation"
        },
        "responses": {
          "200": {
            "description": "Rerun accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRunMutationEnvelope"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/actions/environments/{environmentId}/secrets/imports": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Owner"
        },
        {
          "$ref": "#/components/parameters/Repo"
        },
        {
          "$ref": "#/components/parameters/EnvironmentId"
        }
      ],
      "post": {
        "operationId": "importRepositoryEnvironmentSecrets",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-required-scope": "repo.admin",
        "parameters": [
          {
            "name": "request_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^[\\x21-\\x7E]{1,256}$"
            }
          },
          {
            "name": "reason_code",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[a-z0-9_.-]+$"
            }
          },
          {
            "name": "rotation_policy",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "create_only",
                "upsert"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/plain": {
              "schema": {
                "type": "string",
                "minLength": 1,
                "x-max-bytes": 262144,
                "description": "UTF-8 .env-like write-only secret bundle, limited to 262,144 encoded bytes (not Unicode code points). Plaintext values are never returned by this operation."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Secret bundle imported atomically",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentSecretImport"
                },
                "examples": {
                  "contract": {
                    "summary": "Metadata-only import result",
                    "value": {
                      "contract": "actions-environment-bundle/v1",
                      "request_id": "bundle-1",
                      "rotation_policy": "create_only",
                      "replayed": false,
                      "secrets": [
                        {
                          "id": "secret_01J00000000000000000000000",
                          "name": "DEPLOY_TOKEN",
                          "key_reference": "kms://actions/example-key",
                          "version": 1,
                          "created_at": "2026-08-31T00:00:00Z",
                          "updated_at": "2026-08-31T00:00:00Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The request ID was already used with a different bundle, or create_only encountered a secret name that already exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "parameters": {
      "Owner": {
        "name": "owner",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        }
      },
      "Repo": {
        "name": "repo",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        }
      },
      "Number": {
        "name": "number",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "LabelId": {
        "name": "labelId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "RunId": {
        "name": "runId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "WorkflowId": {
        "name": "workflowId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        }
      },
      "EnvironmentId": {
        "name": "environmentId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 68,
          "maxLength": 68,
          "pattern": "^env_[0-9a-f]{64}$"
        }
      },
      "IssueState": {
        "name": "state",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "open",
            "closed"
          ]
        }
      },
      "PullRequestState": {
        "name": "state",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "open",
            "closed",
            "merged",
            "all"
          ]
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9._:-]{8,128}$"
        }
      },
      "OptionalIdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9._:-]{8,128}$"
        }
      },
      "WorkflowRunStatus": {
        "name": "status",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "completed",
            "action_required",
            "cancelled",
            "failure",
            "neutral",
            "skipped",
            "stale",
            "success",
            "timed_out",
            "in_progress",
            "queued",
            "requested",
            "waiting",
            "pending"
          ]
        }
      },
      "Page": {
        "name": "page",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10000,
          "default": 1
        }
      },
      "PerPage": {
        "name": "per_page",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      }
    },
    "requestBodies": {
      "DeviceTokenExchange": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "grant_type",
                "device_code",
                "client_id"
              ],
              "properties": {
                "grant_type": {
                  "type": "string",
                  "const": "urn:ietf:params:oauth:grant-type:device_code"
                },
                "device_code": {
                  "type": "string",
                  "minLength": 32
                },
                "client_id": {
                  "type": "string",
                  "const": "gbb-cli"
                }
              }
            }
          }
        }
      },
      "DeviceCancellation": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "device_code",
                "client_id"
              ],
              "properties": {
                "device_code": {
                  "type": "string",
                  "minLength": 32
                },
                "client_id": {
                  "type": "string",
                  "const": "gbb-cli"
                }
              }
            }
          }
        }
      },
      "CreateRepository": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name"
              ],
              "allOf": [
                {
                  "if": {
                    "required": [
                      "visibility",
                      "private"
                    ],
                    "properties": {
                      "private": {
                        "const": true
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "visibility": {
                        "const": "private"
                      }
                    }
                  }
                },
                {
                  "if": {
                    "required": [
                      "visibility",
                      "private"
                    ],
                    "properties": {
                      "private": {
                        "const": false
                      }
                    }
                  },
                  "then": {
                    "properties": {
                      "visibility": {
                        "enum": [
                          "public",
                          "internal"
                        ]
                      }
                    }
                  }
                }
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "description": {
                  "type": "string",
                  "maxLength": 350
                },
                "visibility": {
                  "type": "string",
                  "enum": [
                    "private",
                    "internal",
                    "public"
                  ]
                },
                "private": {
                  "type": "boolean"
                },
                "defaultBranch": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128,
                  "x-max-bytes": 128,
                  "description": "Optional safe Git branch name, limited to 128 UTF-8 bytes, used as the default for a newly created non-template repository."
                }
              }
            }
          }
        }
      },
      "CreateIssue": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title",
                "body"
              ],
              "properties": {
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "body": {
                  "type": "string",
                  "maxLength": 65536
                }
              }
            }
          }
        }
      },
      "UpdateIssue": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "state": {
                  "type": "string",
                  "enum": [
                    "open",
                    "closed"
                  ]
                },
                "state_reason": {
                  "type": "string",
                  "enum": [
                    "completed",
                    "not_planned",
                    "duplicate"
                  ]
                },
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "body": {
                  "type": "string",
                  "maxLength": 65536
                },
                "issue_type_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "WriteLabel": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name",
                "color"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "color": {
                  "type": "string",
                  "pattern": "^[0-9A-Fa-f]{6}$"
                }
              }
            }
          }
        }
      },
      "UpdateLabel": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100
                },
                "color": {
                  "type": "string",
                  "pattern": "^[0-9A-Fa-f]{6}$"
                }
              }
            }
          }
        }
      },
      "CreatePullRequest": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title",
                "body",
                "base",
                "head",
                "draft"
              ],
              "properties": {
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "body": {
                  "type": "string",
                  "maxLength": 65536
                },
                "base": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                "head": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                "draft": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      },
      "UpdatePullRequest": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "state": {
                  "type": "string",
                  "enum": [
                    "open",
                    "closed"
                  ]
                }
              }
            }
          }
        }
      },
      "UpdatePullRequestBranch": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "expectedHeadSha"
              ],
              "properties": {
                "expectedHeadSha": {
                  "type": "string",
                  "pattern": "^(?:[0-9A-Fa-f]{40}|[0-9A-Fa-f]{64})$"
                }
              }
            }
          }
        }
      },
      "CreateReview": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "state",
                "body"
              ],
              "properties": {
                "state": {
                  "type": "string",
                  "enum": [
                    "approved",
                    "changes_requested",
                    "commented"
                  ]
                },
                "body": {
                  "type": "string",
                  "maxLength": 65536
                }
              }
            }
          }
        }
      },
      "MergePullRequest": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "method",
                "expectedHeadSha"
              ],
              "properties": {
                "method": {
                  "type": "string",
                  "enum": [
                    "merge",
                    "squash",
                    "rebase"
                  ]
                },
                "expectedHeadSha": {
                  "type": "string",
                  "pattern": "^(?:[0-9A-Fa-f]{40}|[0-9A-Fa-f]{64})$"
                }
              }
            }
          }
        }
      },
      "DispatchWorkflow": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "ref",
                "inputs",
                "request_id"
              ],
              "properties": {
                "ref": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                },
                "inputs": {
                  "type": "object",
                  "maxProperties": 25,
                  "additionalProperties": {
                    "type": [
                      "string",
                      "boolean"
                    ]
                  }
                },
                "request_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              }
            }
          }
        }
      },
      "WorkflowRunMutation": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "idempotency_key"
              ],
              "properties": {
                "idempotency_key": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "expected_version": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "grace_period_ms": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 300000
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "NoContent": {
        "description": "Request completed with no response body"
      },
      "Error": {
        "description": "Stable API error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      }
    },
    "schemas": {
      "Repository": {
        "type": "object",
        "required": [
          "id",
          "owner",
          "name",
          "fullName",
          "defaultBranch"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "owner": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "fullName": {
            "type": "string"
          },
          "defaultBranch": {
            "type": "string",
            "minLength": 1,
            "description": "Configured default branch."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "visibility": {
            "type": "string",
            "enum": [
              "private",
              "internal",
              "public"
            ]
          }
        }
      },
      "RepositoryEnvelope": {
        "type": "object",
        "required": [
          "repository"
        ],
        "properties": {
          "repository": {
            "$ref": "#/components/schemas/Repository"
          }
        }
      },
      "Issue": {
        "type": "object",
        "required": [
          "id",
          "number",
          "title",
          "body",
          "state"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": "integer",
            "minimum": 1
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "open",
              "closed"
            ]
          },
          "stateReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "labels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Label"
            }
          }
        }
      },
      "IssueEnvelope": {
        "type": "object",
        "required": [
          "issue"
        ],
        "properties": {
          "issue": {
            "$ref": "#/components/schemas/Issue"
          }
        }
      },
      "IssueList": {
        "type": "object",
        "required": [
          "issues",
          "pagination"
        ],
        "properties": {
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "perPage": {
            "type": "integer",
            "minimum": 1
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "Label": {
        "type": "object",
        "required": [
          "id",
          "name",
          "color"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "pattern": "^[0-9A-Fa-f]{6}$"
          }
        }
      },
      "LabelEnvelope": {
        "type": "object",
        "required": [
          "label"
        ],
        "properties": {
          "label": {
            "$ref": "#/components/schemas/Label"
          }
        }
      },
      "LabelList": {
        "type": "object",
        "required": [
          "labels"
        ],
        "properties": {
          "labels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Label"
            }
          }
        }
      },
      "PullRequestSummary": {
        "type": "object",
        "required": [
          "id",
          "number",
          "title",
          "state",
          "base",
          "head"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": "integer",
            "minimum": 1
          },
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "open",
              "closed",
              "merged"
            ]
          },
          "draft": {
            "type": "boolean"
          },
          "base": {
            "type": "string"
          },
          "head": {
            "type": "string"
          }
        }
      },
      "PullRequestDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PullRequestSummary"
          },
          {
            "type": "object",
            "required": [
              "sameRepository",
              "baseSha",
              "headSha"
            ],
            "properties": {
              "sameRepository": {
                "type": "boolean"
              },
              "baseSha": {
                "type": "string"
              },
              "headSha": {
                "type": "string"
              }
            }
          }
        ]
      },
      "PullRequestMergeIdentity": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "number",
          "state",
          "baseSha",
          "headSha"
        ],
        "properties": {
          "number": {
            "type": "integer",
            "minimum": 1
          },
          "state": {
            "type": "string",
            "enum": [
              "open",
              "closed",
              "merged"
            ]
          },
          "baseSha": {
            "type": "string"
          },
          "headSha": {
            "type": "string"
          }
        }
      },
      "PullRequestEnvelope": {
        "type": "object",
        "required": [
          "pullRequest"
        ],
        "properties": {
          "pullRequest": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PullRequestDetail"
              },
              {
                "$ref": "#/components/schemas/PullRequestMergeIdentity"
              }
            ]
          }
        }
      },
      "PullRequestBranchUpdateEnvelope": {
        "type": "object",
        "required": [
          "message",
          "pullRequest"
        ],
        "properties": {
          "message": {
            "type": "string"
          },
          "pullRequest": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PullRequestDetail"
              },
              {
                "$ref": "#/components/schemas/PullRequestMergeIdentity"
              }
            ]
          }
        }
      },
      "PullRequestSummaryEnvelope": {
        "type": "object",
        "required": [
          "pullRequest"
        ],
        "properties": {
          "pullRequest": {
            "$ref": "#/components/schemas/PullRequestSummary"
          }
        }
      },
      "PullRequestList": {
        "type": "object",
        "required": [
          "pullRequests",
          "pagination"
        ],
        "properties": {
          "pullRequests": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PullRequestSummary"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "OffsetPagination": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "page",
          "perPage",
          "hasNext"
        ],
        "properties": {
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "perPage": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "hasNext": {
            "type": "boolean"
          }
        }
      },
      "Review": {
        "type": "object",
        "required": [
          "id",
          "state",
          "body"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "approved",
              "changes_requested",
              "commented",
              "dismissed"
            ]
          },
          "body": {
            "type": "string"
          }
        }
      },
      "ReviewEnvelope": {
        "type": "object",
        "required": [
          "review"
        ],
        "properties": {
          "review": {
            "$ref": "#/components/schemas/Review"
          }
        }
      },
      "ReviewList": {
        "type": "object",
        "required": [
          "reviews"
        ],
        "properties": {
          "reviews": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Review"
            }
          }
        }
      },
      "CheckRun": {
        "type": "object",
        "required": [
          "id",
          "headSha",
          "status",
          "conclusion"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "headSha": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "conclusion": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CheckSummary": {
        "type": "object",
        "required": [
          "headSha",
          "checks"
        ],
        "properties": {
          "headSha": {
            "type": "string"
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckSummaryItem"
            }
          }
        }
      },
      "CheckSummaryItem": {
        "type": "object",
        "required": [
          "id",
          "status",
          "conclusion"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "conclusion": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CheckRunEnvelope": {
        "type": "object",
        "required": [
          "checkRun"
        ],
        "properties": {
          "checkRun": {
            "$ref": "#/components/schemas/CheckRun"
          }
        }
      },
      "Workflow": {
        "type": "object",
        "required": [
          "id",
          "name",
          "path",
          "state"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "state": {
            "type": "string"
          }
        }
      },
      "WorkflowList": {
        "type": "object",
        "required": [
          "workflows"
        ],
        "properties": {
          "workflows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Workflow"
            }
          }
        }
      },
      "WorkflowRun": {
        "type": "object",
        "required": [
          "id",
          "status",
          "conclusion"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "conclusion": {
            "type": [
              "string",
              "null"
            ]
          },
          "headSha": {
            "type": "string"
          }
        }
      },
      "WorkflowRunList": {
        "type": "object",
        "required": [
          "workflow_runs"
        ],
        "properties": {
          "workflow_runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRun"
            }
          }
        }
      },
      "WorkflowRunEnvelope": {
        "type": "object",
        "required": [
          "run"
        ],
        "properties": {
          "run": {
            "$ref": "#/components/schemas/ActionsRunSnapshot"
          }
        }
      },
      "WorkflowRunMutationEnvelope": {
        "type": "object",
        "required": [
          "created",
          "run"
        ],
        "properties": {
          "created": {
            "type": "boolean"
          },
          "run": {
            "$ref": "#/components/schemas/ActionsRunSnapshot"
          }
        }
      },
      "ActionsRunSnapshot": {
        "type": "object",
        "required": [
          "id",
          "repositoryId",
          "headSha",
          "state",
          "conclusion",
          "version"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "repositoryId": {
            "type": "string"
          },
          "headSha": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "conclusion": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "EnvironmentSecretImport": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "contract",
          "request_id",
          "rotation_policy",
          "replayed",
          "secrets"
        ],
        "properties": {
          "contract": {
            "type": "string",
            "const": "actions-environment-bundle/v1"
          },
          "request_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "rotation_policy": {
            "type": "string",
            "enum": [
              "create_only",
              "upsert"
            ]
          },
          "replayed": {
            "type": "boolean"
          },
          "secrets": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/ImportedEnvironmentSecret"
            }
          }
        }
      },
      "ImportedEnvironmentSecret": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "key_reference",
          "version",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "name": {
            "type": "string",
            "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
            "maxLength": 255
          },
          "key_reference": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DeviceCodeRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "client_id",
          "scope"
        ],
        "properties": {
          "client_id": {
            "type": "string",
            "const": "gbb-cli"
          },
          "scope": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "pattern": "^\\S+(?: \\S+)*$",
            "description": "Space-delimited exact CLI scopes shown during Better Auth approval."
          }
        }
      },
      "DeviceCodeResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "device_code",
          "user_code",
          "verification_uri",
          "verification_uri_complete",
          "expires_in",
          "interval"
        ],
        "properties": {
          "device_code": {
            "type": "string",
            "minLength": 32
          },
          "user_code": {
            "type": "string",
            "minLength": 4,
            "maxLength": 32,
            "pattern": "^[A-Za-z0-9-]+$"
          },
          "verification_uri": {
            "type": "string",
            "format": "uri"
          },
          "verification_uri_complete": {
            "type": "string",
            "format": "uri"
          },
          "expires_in": {
            "type": "integer",
            "minimum": 60,
            "maximum": 900
          },
          "interval": {
            "type": "integer",
            "minimum": 5,
            "maximum": 30
          }
        }
      },
      "OAuthError": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error",
          "error_description"
        ],
        "properties": {
          "error": {
            "type": "string",
            "minLength": 1
          },
          "error_description": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "UserEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "user",
          "scopes",
          "expiresAt"
        ],
        "properties": {
          "user": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "username",
              "displayName",
              "image"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "username": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "image": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              }
            }
          },
          "scopes": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "CredentialEnvelope": {
        "type": "object",
        "required": [
          "credential"
        ],
        "properties": {
          "credential": {
            "$ref": "#/components/schemas/Credential"
          }
        }
      },
      "DevicePoll": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "state",
              "interval"
            ],
            "properties": {
              "state": {
                "type": "string",
                "const": "authorization_pending"
              },
              "interval": {
                "type": "integer",
                "minimum": 5,
                "maximum": 30
              }
            }
          },
          {
            "type": "object",
            "required": [
              "state",
              "interval"
            ],
            "properties": {
              "state": {
                "type": "string",
                "const": "slow_down"
              },
              "interval": {
                "type": "integer",
                "minimum": 5,
                "maximum": 30
              }
            }
          },
          {
            "type": "object",
            "required": [
              "state"
            ],
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "access_denied",
                  "expired_token"
                ]
              }
            }
          },
          {
            "allOf": [
              {
                "type": "object",
                "required": [
                  "state"
                ],
                "properties": {
                  "state": {
                    "type": "string",
                    "const": "authorized"
                  }
                }
              },
              {
                "$ref": "#/components/schemas/CredentialEnvelope"
              }
            ]
          }
        ]
      },
      "Credential": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "credential_id",
          "access_token",
          "refresh_token",
          "expires_in",
          "refresh_expires_in",
          "access_expires_at",
          "refresh_expires_at",
          "scopes",
          "account"
        ],
        "properties": {
          "credential_id": {
            "type": "string"
          },
          "access_token": {
            "type": "string",
            "pattern": "^gbb_at_"
          },
          "refresh_token": {
            "type": "string",
            "pattern": "^gbb_rt_"
          },
          "expires_in": {
            "type": "integer",
            "minimum": 60,
            "maximum": 3600
          },
          "refresh_expires_in": {
            "type": "integer",
            "minimum": 3600,
            "maximum": 2592000,
            "description": "The minimum equals the maximum access lifetime, enforcing refresh_expires_in >= expires_in."
          },
          "access_expires_at": {
            "type": "integer",
            "minimum": 0,
            "description": "Authoritative access-token expiry as Unix seconds."
          },
          "refresh_expires_at": {
            "type": "integer",
            "minimum": 0,
            "description": "Authoritative refresh-family expiry as Unix seconds."
          },
          "scopes": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          },
          "account": {
            "type": "object",
            "required": [
              "id",
              "login",
              "display_name"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "login": {
                "type": "string"
              },
              "display_name": {
                "type": "string"
              }
            }
          }
        }
      },
      "GitCredentialEnvelope": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "credential"
        ],
        "properties": {
          "credential": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "grant_id",
              "username",
              "password",
              "expires_in",
              "repository_id",
              "operation"
            ],
            "properties": {
              "grant_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "username": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              },
              "password": {
                "type": "string",
                "pattern": "^gbb_git_",
                "maxLength": 1024
              },
              "expires_in": {
                "type": "integer",
                "minimum": 1,
                "maximum": 300
              },
              "repository_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "operation": {
                "type": "string",
                "enum": [
                  "clone",
                  "fetch",
                  "push"
                ]
              }
            }
          }
        }
      },
      "ApiError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "invalid_json",
                  "unsupported_media_type",
                  "validation_failed",
                  "unauthorized",
                  "forbidden",
                  "not_found",
                  "insufficient_scope",
                  "invalid_refresh",
                  "rate_limited",
                  "unavailable",
                  "not_configured",
                  "invalid_configuration",
                  "invalid_response",
                  "identity_unavailable",
                  "payload_too_large",
                  "request_timeout",
                  "invalid_check_identity",
                  "check_authority_unavailable",
                  "check_run_conflict",
                  "check_suite_conflict",
                  "commit_status_conflict",
                  "environment_bundle_idempotency_conflict",
                  "secret_version_conflict",
                  "deletion_blocked",
                  "export_unavailable",
                  "fresh_session_required",
                  "internal_error",
                  "invalid_batch",
                  "invalid_body",
                  "invalid_cursor",
                  "invalid_default_branch",
                  "invalid_email_update",
                  "invalid_export",
                  "invalid_idempotency_key",
                  "idempotency_in_progress",
                  "idempotency_key_reused",
                  "invalid_invitation",
                  "invalid_issue_comment_query",
                  "invalid_issue_number",
                  "invalid_issue_query",
                  "invalid_issue_template",
                  "invalid_issue_type",
                  "invalid_label",
                  "invalid_label_id",
                  "invalid_label_query",
                  "invalid_limit",
                  "invalid_member",
                  "invalid_merge",
                  "invalid_pagination",
                  "invalid_password",
                  "invalid_path",
                  "invalid_permission",
                  "invalid_policy",
                  "invalid_preferences",
                  "invalid_pull_request",
                  "invalid_pull_request_mutation",
                  "invalid_pull_request_number",
                  "invalid_pull_request_query",
                  "invalid_ref",
                  "invalid_release_query",
                  "invalid_repository_activity",
                  "invalid_title",
                  "invalid_request_id",
                  "invalid_review_policy",
                  "invalid_revision",
                  "invalid_search",
                  "invalid_sha",
                  "invalid_state",
                  "invalid_team",
                  "invalid_token",
                  "issue_locked",
                  "issue_template_required",
                  "label_conflict",
                  "precondition_required",
                  "pull_request_closed",
                  "pull_request_conflict",
                  "pull_request_create_failed",
                  "ref_not_found",
                  "release_not_found",
                  "repository_activity_failed",
                  "revision_conflict",
                  "unknown_check_suite",
                  "unknown_commit"
                ]
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    }
  }
}
