mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 12:52:19 +01:00
Each same-repo pull request gets its own Fly.io app at romm-pr-<number>.fly.dev, built from a new preview-image stage that bundles PostgreSQL and seeds 500 roms with generate_test_data.py on boot. The app stops when idle, is destroyed when the PR closes, and a nightly run sweeps any preview whose teardown was missed. Nothing deploys until the FLY_API_TOKEN secret is set. Measured locally on 1 CPU and 1GB: about 65s from boot to a working API, and a 730MB peak while browsing, so previews use shared-cpu-1x with 1GB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iq36yZccNujCwQVxx
23 lines
722 B
Bash
Executable File
23 lines
722 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Creates or updates the single preview comment on a pull request.
|
|
# Usage: preview_comment.sh <pr-number> <body> (needs GH_TOKEN and GITHUB_REPOSITORY)
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
pr="$1"
|
|
marker="<!-- romm-preview -->"
|
|
body="${marker}
|
|
$2"
|
|
|
|
comment_id=$(gh api "repos/${GITHUB_REPOSITORY}/issues/${pr}/comments" --paginate \
|
|
--jq ".[] | select(.user.login == \"github-actions[bot]\" and (.body | startswith(\"${marker}\"))) | .id" |
|
|
head -n 1)
|
|
|
|
if [[ -n ${comment_id} ]]; then
|
|
gh api -X PATCH "repos/${GITHUB_REPOSITORY}/issues/comments/${comment_id}" -f body="${body}" >/dev/null
|
|
else
|
|
gh api "repos/${GITHUB_REPOSITORY}/issues/${pr}/comments" -f body="${body}" >/dev/null
|
|
fi
|