mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-06-10 00:02:37 -06:00
Document bootstrap-first workflow; verify dry-run in CI; live bootstrap preflight validated against Documents archives.
50 lines
1.2 KiB
Bash
Executable file
50 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -Eeuo pipefail
|
|
|
|
REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)
|
|
BOOTSTRAP="$REPO_ROOT/scripts/bootstrap-recurring-scrape.sh"
|
|
TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/dce-bootstrap-smoke.XXXXXX")
|
|
|
|
cleanup() {
|
|
rm -rf "$TMP_DIR"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
[[ -x "$BOOTSTRAP" ]] || {
|
|
printf 'bootstrap-recurring-scrape.sh is not executable\n' >&2
|
|
exit 1
|
|
}
|
|
|
|
"$BOOTSTRAP" --help | grep -q 'bootstrap-recurring-scrape' || {
|
|
printf 'bootstrap --help missing expected text\n' >&2
|
|
exit 1
|
|
}
|
|
|
|
mkdir -p "$TMP_DIR/archive/demo"
|
|
printf '{"messages":[{"id":"1","timestamp":"2020-01-01T00:00:00+00:00"}],"channel":{"id":"111111111111111111"}}\n' \
|
|
>"$TMP_DIR/archive/demo/Guild - general [111111111111111111].json"
|
|
|
|
cat >"$TMP_DIR/config.json" <<JSON
|
|
{
|
|
"archive_root": "$TMP_DIR",
|
|
"targets": [
|
|
{
|
|
"name": "demo",
|
|
"kind": "guild",
|
|
"output_dir": "$TMP_DIR/archive/demo",
|
|
"channel_ids": ["111111111111111111"],
|
|
"guild_ids": [],
|
|
"guild_name_patterns": []
|
|
}
|
|
]
|
|
}
|
|
JSON
|
|
|
|
"$BOOTSTRAP" --dry-run --config "$TMP_DIR/config.json" | grep -q 'Dry run complete' || {
|
|
printf 'bootstrap --dry-run did not complete\n' >&2
|
|
exit 1
|
|
}
|
|
|
|
printf 'bootstrap-recurring-scrape-smoke: ok\n'
|