No description
  • Python 90%
  • Dockerfile 10%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Lukas Schaefer b8d06d3f9b
Initial commit
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
2026-07-25 13:20:52 -04:00
app.py Initial commit 2026-07-25 13:20:52 -04:00
docker-compose.yaml Initial commit 2026-07-25 13:20:52 -04:00
Dockerfile Initial commit 2026-07-25 13:20:52 -04:00
README.md Initial commit 2026-07-25 13:20:52 -04:00
requirements.txt Initial commit 2026-07-25 13:20:52 -04:00

forgejo-pages

Simple HTTP service that clones or updates a git repository into a local output directory. Useful for deploying static sites (e.g. Forgejo Pages) behind Caddy.

API

POST /update-project

Accepts JSON or form data.

Parameter Required Description
secret yes Must match the SECRET environment variable
git_repo yes Git repository URL to clone/fetch
output_directory yes Project folder name under /pages (e.g. personal-website)
branch no Branch to deploy; defaults to the repository default branch

Example:

curl -X POST http://localhost:8080/update-project \
  -H "Content-Type: application/json" \
  -d '{
    "secret": "change-me",
    "git_repo": "https://git.example.com/user/repo.git",
    "output_directory": "personal-website",
    "branch": "main"
  }'

This stores the repo in /pages/personal-website.

Behavior:

  • If /pages/<name> is already a git repo → shallow-fetch (--depth 1) the branch tip and update in place
  • If the directory exists but is not a git repo → delete it and clone fresh
  • If the directory does not exist → shallow-clone into that path

GET /health

Returns {"status": "ok"}.

Environment

Variable Description
SECRET Shared secret required by /update-project
PAGES_ROOT Allowed root for checkouts (default /pages)
GIT_TIMEOUT Max seconds for a git command (default 300)