# Ensure lockfile is up to date if package.json changed
if git diff --cached --name-only | grep -q "^package.json$"; then
    echo "🔒 Updating lockfile..."
    pnpm lock

    # Build the action before committing
    echo "🔨 Building action..."
    pnpm build

    # Add the built files and lockfile to the commit
    git add entry mcp-server pnpm-lock.yaml
fi
