Add daily wiki content export

Export script pulls all Outline documents via API and writes them as
flat markdown files to content/wiki/ with frontmatter metadata.
Cron wrapper auto-commits changes daily.
This commit is contained in:
Jennie Robinson Faber 2026-03-04 17:34:09 +00:00
parent b5de1e575a
commit 2bb36af20e
37 changed files with 5272 additions and 0 deletions

33
scripts/export-content-cron.sh Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
# Daily wiki content export — run via cron:
# 0 4 * * * /path/to/wiki-ghostguild/scripts/export-content-cron.sh >> /var/log/wiki-export.log 2>&1
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_DIR"
# Source env vars (line-by-line to handle unquoted values with spaces)
while IFS='=' read -r key value; do
[[ -z "$key" || "$key" =~ ^# ]] && continue
export "$key=$value"
done < outline.env
# Map Outline's URL to OUTLINE_URL if not already set
export OUTLINE_URL="${OUTLINE_URL:-$URL}"
# OUTLINE_API_TOKEN must be set in the environment or in outline.env
if [[ -z "${OUTLINE_API_TOKEN:-}" ]]; then
echo "Error: OUTLINE_API_TOKEN is not set" >&2
exit 1
fi
# Run export
node scripts/export-content.js
# Commit and push if there are changes
git add content/wiki/
if ! git diff --cached --quiet; then
git commit -m "wiki content export $(date +%Y-%m-%d)"
git push
fi