Skip to content

Daily Morph Snapshot #122

Daily Morph Snapshot

Daily Morph Snapshot #122

name: Daily Morph Snapshot
on:
schedule:
- cron: "0 18 * * *" # 10am PST / 11am PDT
workflow_dispatch:
concurrency:
group: morph-snapshot
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
env:
NODE_VERSION: "24"
BUN_VERSION: "1.2.21"
GO_VERSION: "1.23"
jobs:
morph-snapshot:
name: Build Morph Snapshot
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup uv
uses: astral-sh/setup-uv@v4
- name: Cache Bun install cache
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
key: ${{ runner.os }}-bun-install-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-install-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run morph snapshot (with retry)
env:
MORPH_API_KEY: ${{ secrets.MORPH_API_KEY }}
run: |
max_attempts=3
attempt=1
while [ $attempt -le $max_attempts ]; do
echo "Attempt $attempt of $max_attempts"
if uv run ./scripts/snapshot.py; then
echo "Snapshot completed successfully"
exit 0
fi
echo "Attempt $attempt failed"
if [ $attempt -lt $max_attempts ]; then
echo "Waiting 30 seconds before retry..."
sleep 30
fi
attempt=$((attempt + 1))
done
echo "All $max_attempts attempts failed"
exit 1
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "No changes detected"
echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
echo "Changes detected"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi
- name: Configure git user
if: steps.changes.outputs.has_changes == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create branch and commit
if: steps.changes.outputs.has_changes == 'true'
id: commit
run: |
BRANCH_NAME="morph-snapshot-$(date +%Y%m%d-%H%M%S)"
git checkout -b "$BRANCH_NAME"
git add configs/ide-deps.json packages/shared/src/morph-snapshots.json
git commit -m "chore: daily morph snapshot update"
git push -u origin "$BRANCH_NAME"
echo "branch=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
- name: Create Pull Request
if: steps.changes.outputs.has_changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--title "chore: daily morph snapshot update" \
--body "Automated daily morph snapshot update.
## Changes
- Updated morph snapshots to latest version
- Updated IDE extension and CLI package versions
## Test plan
- [ ] Verify new snapshots work by starting a sandbox session" \
--head "${{ steps.commit.outputs.branch }}" \
--base main