Added GitHub webhook functionality and configuration for API interaction

This commit introduces functionality for GitHub webhook interaction and API calls. The git operations are handled by a custom GitHub client in PHP, details for API endpoints are outlined in a new OpenAPI schema, and the project setup includes PHP FPM and NGINX configuration using Docker. A webhook receiver is also added to process incoming webhook payloads.
This commit is contained in:
stephan.kasdorf
2024-05-29 15:32:08 +02:00
commit 40139d144b
8 changed files with 482 additions and 0 deletions

302
gpt-schema.yml Normal file
View File

@@ -0,0 +1,302 @@
openapi: 3.0.0
info:
title: UpdateGPTOnPush Webhook
description: Webhook to update GPT on push events from a GitHub repository.
version: 1.0.0
servers:
- url: https://api.github.com
description: GitHub API Server
paths:
/repos/{owner}/{repo}/contents/{path}:
get:
operationId: getRepositoryContent
summary: Get the contents of a repository
description: Fetch the contents of a file or directory in a repository.
parameters:
- name: owner
in: path
required: true
schema:
type: string
description: The owner of the repository.
- name: repo
in: path
required: true
schema:
type: string
description: The name of the repository.
- name: path
in: path
required: true
schema:
type: string
description: The content path.
- name: ref
in: query
schema:
type: string
description: The name of the commit/branch/tag. Default is the repositorys default branch (usually master).
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
type:
type: string
description: Type of content (file, directory, symlink, submodule).
encoding:
type: string
description: Encoding of the content (if file).
size:
type: integer
description: Size of the content (if file).
name:
type: string
description: Name of the content.
path:
type: string
description: Path of the content.
content:
type: string
description: Base64 encoded content (if file).
sha:
type: string
description: SHA identifier of the content.
url:
type: string
description: URL to access the content.
git_url:
type: string
description: Git URL to access the content.
html_url:
type: string
description: HTML URL to access the content.
download_url:
type: string
description: Download URL to access the content.
_links:
type: object
properties:
self:
type: string
description: Self link.
git:
type: string
description: Git link.
html:
type: string
description: HTML link.
'404':
description: Content not found
/repos/{owner}/{repo}/commits:
get:
operationId: listCommits
summary: List commits in a repository
description: Retrieve a list of commits in a repository.
parameters:
- name: owner
in: path
required: true
schema:
type: string
description: The owner of the repository.
- name: repo
in: path
required: true
schema:
type: string
description: The name of the repository.
- name: sha
in: query
schema:
type: string
description: SHA or branch to start listing commits from.
- name: path
in: query
schema:
type: string
description: Only commits containing this file path will be returned.
- name: author
in: query
schema:
type: string
description: GitHub username or email of the author.
- name: since
in: query
schema:
type: string
format: date-time
description: Only commits after this date will be returned.
- name: until
in: query
schema:
type: string
format: date-time
description: Only commits before this date will be returned.
- name: per_page
in: query
schema:
type: integer
default: 30
description: Number of results per page (max 100).
- name: page
in: query
schema:
type: integer
default: 1
description: Page number of the results to fetch.
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
type: object
properties:
sha:
type: string
description: SHA of the commit.
node_id:
type: string
description: Node ID of the commit.
commit:
type: object
properties:
author:
type: object
properties:
name:
type: string
email:
type: string
date:
type: string
format: date-time
committer:
type: object
properties:
name:
type: string
email:
type: string
date:
type: string
format: date-time
message:
type: string
tree:
type: object
properties:
sha:
type: string
url:
type: string
url:
type: string
comment_count:
type: integer
url:
type: string
html_url:
type: string
comments_url:
type: string
author:
type: object
properties:
login:
type: string
id:
type: integer
node_id:
type: string
avatar_url:
type: string
gravatar_id:
type: string
url:
type: string
html_url:
type: string
followers_url:
type: string
following_url:
type: string
gists_url:
type: string
starred_url:
type: string
subscriptions_url:
type: string
organizations_url:
type: string
repos_url:
type: string
events_url:
type: string
received_events_url:
type: string
type:
type: string
site_admin:
type: boolean
committer:
type: object
properties:
login:
type: string
id:
type: integer
node_id:
type: string
avatar_url:
type: string
gravatar_id:
type: string
url:
type: string
html_url:
type: string
followers_url:
type: string
following_url:
type: string
gists_url:
type: string
starred_url:
type: string
subscriptions_url:
type: string
organizations_url:
type: string
repos_url:
type: string
events_url:
type: string
received_events_url:
type: string
type:
type: string
site_admin:
type: boolean
parents:
type: array
items:
type: object
properties:
sha:
type: string
url:
type: string
html_url:
type: string
'404':
description: Repository not found
components:
schemas: {}