Skip to content

Instantly share code, notes, and snippets.

@phwelo
Created December 17, 2024 01:44
Show Gist options
  • Save phwelo/57401bb0a29500f0892d4cfa9bec4e73 to your computer and use it in GitHub Desktop.
Save phwelo/57401bb0a29500f0892d4cfa9bec4e73 to your computer and use it in GitHub Desktop.
This is an action schema for ChatGPT Custom GPT Actions to read all text files from a Github repo.
  • replace "phwelo" with your username
  • replace "parenting-gpt" with your repo name
  • i use a query like this to verify it's got the data:
    • Load all text files from my repository. Give an overall impression of the data imported.
{
"openapi": "3.1.0",
"info": {
"title": "GitHub Repository File Fetcher",
"description": "Fetches all .txt files from the root of the 'phwelo/parenting-gpt' repository.",
"version": "v1.0.0"
},
"servers": [
{
"url": "https://api.github.com"
}
],
"paths": {
"/repos/phwelo/parenting-gpt/contents": {
"get": {
"operationId": "GetFileList",
"description": "Fetches the list of all files in the root directory of the repository.",
"responses": {
"200": {
"description": "Successfully retrieved the list of files.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the file."
},
"path": {
"type": "string",
"description": "The full path of the file."
},
"type": {
"type": "string",
"description": "The type of object (e.g., file, dir)."
}
}
}
}
}
}
}
}
}
},
"/repos/phwelo/parenting-gpt/contents/{path}": {
"get": {
"operationId": "GetFileContent",
"description": "Fetches the content of a specific file in the repository.",
"parameters": [
{
"name": "path",
"in": "path",
"required": true,
"schema": {
"type": "string",
"description": "The full path of the file."
}
}
],
"responses": {
"200": {
"description": "Successfully retrieved the file content.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "Base64-encoded content of the file."
},
"encoding": {
"type": "string",
"description": "The encoding format of the content."
}
}
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment