Skip to content

mcp-ui-version-sync

mcp-ui-version-sync #1

# Keeps apps/loopover-ui/src/lib/mcp-package.ts's MCP_PACKAGE_KNOWN_LATEST_VERSION -- the client-side
# graceful-degradation fallback shown when the live npm-registry fetch (useMcpPackageMetadata) fails or hasn't
# resolved yet -- in sync with @loopover/mcp's real npm dist-tags.latest, without ever requiring a human/agent
# to notice a new release and manually edit the constant (#6580). scripts/check-ui-mcp-version-copy.mjs's
# --write mode does the actual sync; this just runs it on a schedule and keeps a standing PR up to date, the
# same shape as orb-stable-release-pr.yml. Nothing ships until a maintainer reviews and merges the PR -- this
# workflow never pushes to main directly.
name: mcp-ui-version-sync
on:
workflow_dispatch:
schedule:
- cron: "30 16 * * *"
permissions:
contents: write # push the mcp-ui-version-sync branch
pull-requests: write # create/update the sync PR
concurrency:
group: mcp-ui-version-sync
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 24.18.0
# No npm ci -- the script only imports Node built-ins.
- name: Sync the known-latest constant
run: node scripts/check-ui-mcp-version-copy.mjs --write
- name: Check for a diff
id: diff
run: |
set -euo pipefail
if git diff --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Extract the synced version
if: steps.diff.outputs.changed == 'true'
id: version
run: |
set -euo pipefail
version="$(grep -oP 'MCP_PACKAGE_KNOWN_LATEST_VERSION\s*=\s*"\K[^"]+' apps/loopover-ui/src/lib/mcp-package.ts)"
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Push the mcp-ui-version-sync branch
if: steps.diff.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.version }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B mcp-ui-version-sync
git add apps/loopover-ui/src/lib/mcp-package.ts
git commit -m "chore(ui): sync MCP known-latest to ${VERSION}"
git remote set-url origin "https://github.com/${GITHUB_REPOSITORY}.git"
gh auth setup-git
git push --force origin mcp-ui-version-sync
- name: Create or refresh the sync PR
if: steps.diff.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.version }}
run: |
set -euo pipefail
title="chore(ui): sync MCP known-latest to ${VERSION}"
body="Auto-generated by mcp-ui-version-sync.yml: \`@loopover/mcp\`'s npm dist-tags.latest is \`${VERSION}\`, ahead of the client-side fallback constant. This constant only shows when the live npm registry fetch fails or hasn't resolved yet (see apps/loopover-ui/src/lib/mcp-package.ts's useMcpPackageMetadata), so keeping it current avoids showing a stale version in that degraded state."
existing="$(gh pr list --head mcp-ui-version-sync --state open --json number --jq '.[0].number // empty')"
if [ -n "$existing" ]; then
gh pr edit "$existing" --title "$title" --body "$body"
else
gh pr create --head mcp-ui-version-sync --base main --title "$title" --body "$body"
fi