1
0
mirror of https://gitlab.com/Anson-Projects/projects.git synced 2025-09-14 09:35:04 +00:00

feat(ghost-upload): add update support, manual CI job, and dependency updates

This commit is contained in:
2025-08-26 11:07:24 -06:00
parent 51c03d9213
commit 6aeb0ea8eb
4 changed files with 763 additions and 520 deletions

View File

@@ -1,3 +1,17 @@
# ghost-upload
This code uploads posts from https://projects.ansonbiggs.com to https://notes.ansonbiggs.com. I couldn't figure out how to update posts, and the kagi API doesn't make it clear how long it caches results for so for now only posts that don't exist on the ghost blog will be uploaded. If you want to update content you need to manually make edits to the code and delete posts on the blog.
This tool uploads posts from https://projects.ansonbiggs.com to https://notes.ansonbiggs.com.
What's new:
- Uses the Ghost Admin API to check for existing posts by slug instead of probing the public site.
- Optional update support: set `UPDATE_EXISTING=true` to update an existing post in-place (via `PUT /ghost/api/v3/admin/posts/{id}?source=html`).
- Safer slug handling (trims trailing `/` and falls back to the last path segment).
Env vars:
- `admin_api_key`: Ghost Admin API key in `key_id:secret` format.
- `kagi_api_key`: Kagi Summarizer API key.
- `UPDATE_EXISTING` (optional): if `true`/`1`, update posts that already exist in Ghost.
Notes:
- Updates use optimistic concurrency by sending the current `updated_at` from Ghost. If someone edits a post in Ghost after we fetch it, the update will fail with a 409 and be reported in the console.
- Summaries are always regenerated when creating or updating; if you want to avoid re-summarizing on updates, leave `UPDATE_EXISTING` unset.