Skip to content

Carry the two testrun screenshots across #2

Carry the two testrun screenshots across

Carry the two testrun screenshots across #2

# Mintlify writes no check runs and no commit statuses, so a failed build leaves no
# trace anywhere in GitHub. This watches for the redeploy instead: if the deployment
# serving docs.fly.io has not changed within the deadline, the build for this commit
# either failed or never started, and this job goes red on the commit.
#
# docs.fly.io is one deployment built from superfly/docs, superfly/sprites-docs and
# superfly/docs-fonts together, so the root URL is the right thing to watch from
# either content repo. A break in one source holds the other.
name: Mintlify build check
on:
push:
branches:
- main
- mintlify-import
paths-ignore:
- '.github/**'
workflow_dispatch:
permissions: {}
concurrency:
group: mintlify-build-check
cancel-in-progress: true
jobs:
redeployed:
name: Wait for the docs site to redeploy
runs-on: ubuntu-latest
timeout-minutes: 30
env:
SITE: https://docs.fly.io/
DEADLINE_MINUTES: '20'
INTERVAL_SECONDS: '30'
steps:
- name: Wait for a new deployment
run: |
set -uo pipefail
deployment() {
curl -sS -I --max-time 20 --retry 3 --retry-delay 5 "$SITE" \
| tr -d '\r' \
| awk 'tolower($1) == "x-version:" { print $2 }'
}
baseline="$(deployment)"
if [ -z "$baseline" ]; then
echo "Could not read x-version from $SITE"
echo "Either the site is unreachable or Mintlify stopped sending that header."
echo "If the header is simply gone, this check needs rewriting rather than fixing."
exit 1
fi
echo "Serving $baseline before this commit."
echo "Waiting up to $DEADLINE_MINUTES minutes for a new deployment."
deadline=$(( $(date +%s) + DEADLINE_MINUTES * 60 ))
while [ "$(date +%s)" -lt "$deadline" ]; do
sleep "$INTERVAL_SECONDS"
current="$(deployment)"
if [ -n "$current" ] && [ "$current" != "$baseline" ]; then
echo "New deployment live: $current"
exit 0
fi
echo " still $baseline, $(( (deadline - $(date +%s)) / 60 + 1 ))m left"
done
echo
echo "No new deployment after $DEADLINE_MINUTES minutes."
echo "docs.fly.io is still serving $baseline, which predates ${GITHUB_SHA:0:12}."
echo "The Mintlify build for this commit failed or never ran."
echo
echo "Check the Activity tab at https://app.mintlify.com and, if a build did fail,"
echo "note that every source is held until it is fixed, not just this repository."
exit 1