Gitty

Gitty · GPT アクション

GitHub Repository Management API

This API allows for managing and retrieving content from a GitHub repository.

  • GET /repos/{owner}/{repo}Get repository information

    This endpoint retrieves information about a GitHub repository.

  • GET /repos/{owner}/{repo}/contents/{path}Gets the contents of a file or directory

    This endpoint retrieves the contents of a file or directory in a GitHub repository.

  • PUT /repos/{owner}/{repo}/contents/{path}Creates or updates a file in a repository

    This endpoint is used to create or update a file in a GitHub repository.

  • GET /repos/{owner}/{repo}/git/trees/{tree_sha}Retrieves the tree structure of a repository

    This endpoint retrieves the tree structure (directories and files) of a repository at the specified SHA.

  • GET /search/repositoriesSearch for repositories

    Searches for repositories on GitHub based on specified keywords and other criteria.

  • GET /repos/{owner}/{repo}/pullsList pull requests

    Lists all pull requests for a repository.

  • POST /repos/{owner}/{repo}/pullsCreate a pull request

    Creates a new pull request in the repository.

  • POST /repos/{owner}/{repo}/forksFork a repository

    Creates a fork of a repository.

  • GET /user/reposLists repositories for the authenticated user.

    Retrieves a list of repositories for the authenticated user. It can optionally compress the results.

  • POST /user/reposCreates a new repository.

    Allows the authenticated user to create a new repository.

  • POST /repos/{template_owner}/{template_repo}/generateGenerate a new repository from a template

    This endpoint generates a new repository from a template repository. To check if a repository is available to use as a template, get the repository's information using the Get a repository endpoint and check that the is_template key is true

元の API スキーマ
{
  "openapi": "3.1.0",
  "info": {
    "title": "GitHub Repository Management API",
    "description": "This API allows for managing and retrieving content from a GitHub repository.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.github.com",
      "description": "GitHub API server"
    }
  ],
  "paths": {
    "/repos/{owner}/{repo}": {
      "get": {
        "operationId": "getRepoInfo",
        "summary": "Get repository information",
        "description": "This endpoint retrieves information about a GitHub repository.",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "The username or organization name that owns the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "The name of the repository",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Repository information retrieved successfully"
          },
          "404": {
            "description": "Repository not found"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/contents/{path}": {
      "get": {
        "operationId": "getContent",
        "summary": "Gets the contents of a file or directory",
        "description": "This endpoint retrieves the contents of a file or directory in a GitHub repository.",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "The username or organization name that owns the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "The name of the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "description": "The content path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Content retrieved successfully"
          },
          "404": {
            "description": "Content not found"
          }
        }
      },
      "put": {
        "operationId": "publishContent",
        "summary": "Creates or updates a file in a repository",
        "description": "This endpoint is used to create or update a file in a GitHub repository.",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "The username or organization name that owns the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "The name of the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "description": "The content path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "description": "The commit message"
                  },
                  "content": {
                    "type": "string",
                    "description": "The new file content, encoded as a Base64 string"
                  },
                  "branch": {
                    "type": "string",
                    "description": "The branch to commit to"
                  }
                },
                "required": [
                  "message",
                  "content"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Content created or updated"
          },
          "400": {
            "description": "Bad request"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/git/trees/{tree_sha}": {
      "get": {
        "operationId": "exploreRepoTree",
        "summary": "Retrieves the tree structure of a repository",
        "description": "This endpoint retrieves the tree structure (directories and files) of a repository at the specified SHA.",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "The username or organization name that owns the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "The name of the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tree_sha",
            "in": "path",
            "required": true,
            "description": "The SHA of the tree",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recursive",
            "in": "query",
            "required": false,
            "description": "Set to 1 to retrieve the entire tree recursively",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tree structure retrieved successfully"
          },
          "404": {
            "description": "Tree not found"
          }
        }
      }
    },
    "/search/repositories": {
      "get": {
        "operationId": "searchRepositories",
        "summary": "Search for repositories",
        "description": "Searches for repositories on GitHub based on specified keywords and other criteria.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "The search keywords, as well as any qualifiers",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "The field to sort by. One of `stars`, `forks`, or `updated`. Default: `best match`",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "description": "The sort order if `sort` parameter is provided. One of `asc` or `desc`",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Results per page (max 100)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number of the results to fetch",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Search results returned successfully"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/pulls": {
      "get": {
        "operationId": "listPullRequests",
        "summary": "List pull requests",
        "description": "Lists all pull requests for a repository.",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "The owner of the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "The repository name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of pull requests"
          },
          "404": {
            "description": "Repository not found"
          }
        }
      },
      "post": {
        "operationId": "createPullRequest",
        "summary": "Create a pull request",
        "description": "Creates a new pull request in the repository.",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "The owner of the repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "The repository name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "head": {
                    "type": "string",
                    "description": "The name of the branch where your changes are implemented"
                  },
                  "base": {
                    "type": "string",
                    "description": "The name of the branch you want the changes pulled into"
                  },
                  "body": {
                    "type": "string",
                    "description": "The contents of the pull request"
                  }
                },
                "required": [
                  "title",
                  "head",
                  "base"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pull request created"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/repos/{owner}/{repo}/forks": {
      "post": {
        "operationId": "createFork",
        "summary": "Fork a repository",
        "description": "Creates a fork of a repository.",
        "parameters": [
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "The owner of the repository to fork",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "The name of the repository to fork",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Forking initiated"
          },
          "404": {
            "description": "Repository not found"
          }
        }
      }
    },
    "/user/repos": {
      "get": {
        "operationId": "listUserRepos",
        "summary": "Lists repositories for the authenticated user.",
        "description": "Retrieves a list of repositories for the authenticated user. It can optionally compress the results.",
        "parameters": [
          {
            "in": "query",
            "name": "compress",
            "schema": {
              "type": "boolean"
            },
            "description": "If set to true, the response will be compressed."
          }
        ],
        "responses": {
          "200": {
            "description": "A list of repositories, optionally compressed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer"
                      },
                      "name": {
                        "type": "string"
                      },
                      "full_name": {
                        "type": "string"
                      },
                      "private": {
                        "type": "boolean"
                      },
                      "owner": {
                        "type": "object",
                        "properties": {
                          "login": {
                            "type": "string"
                          },
                          "id": {
                            "type": "integer"
                          },
                          "url": {
                            "type": "string"
                          }
                        }
                      },
                      "description": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      },
                      "created_at": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "updated_at": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "pushed_at": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "git_url": {
                        "type": "string"
                      },
                      "ssh_url": {
                        "type": "string"
                      },
                      "clone_url": {
                        "type": "string"
                      },
                      "size": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized - Authentication credentials were not provided or are invalid."
          }
        }
      },
      "post": {
        "operationId": "createRepository",
        "summary": "Creates a new repository.",
        "description": "Allows the authenticated user to create a new repository.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Name of the repository."
                  },
                  "description": {
                    "type": "string",
                    "description": "A short description of the repository."
                  },
                  "private": {
                    "type": "boolean",
                    "description": "Whether the repository should be private."
                  },
                  "auto_init": {
                    "type": "boolean",
                    "description": "Pass true to create an initial commit with empty README."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Repository created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "full_name": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized - Authentication credentials were not provided or are invalid."
          }
        }
      }
    },
    "/repos/{template_owner}/{template_repo}/generate": {
      "post": {
        "operationId": "generateRepoFromTemplate",
        "summary": "Generate a new repository from a template",
        "description": "This endpoint generates a new repository from a template repository. To check if a repository is available to use as a template, get the repository's information using the Get a repository endpoint and check that the is_template key is true",
        "parameters": [
          {
            "name": "template_owner",
            "in": "path",
            "required": true,
            "description": "The owner of the template repository",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "template_repo",
            "in": "path",
            "required": true,
            "description": "The name of the template repository",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the new repository"
                  },
                  "description": {
                    "type": "string",
                    "description": "A short description of the new repository"
                  },
                  "private": {
                    "type": "boolean",
                    "description": "Whether the new repository should be private"
                  },
                  "include_all_branches": {
                    "type": "boolean",
                    "description": "Whether to include all branches from the template repository"
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Repository generated successfully"
          },
          "400": {
            "description": "Bad request"
          }
        }
      }
    }
  }
}