Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/sync-spannerlib-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Sync SpannerLib Node code from go-sql-spanner

permissions:
contents: read

on:
pull_request:
workflow_dispatch: # Allows manual triggering

jobs:
sync-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
persist-credentials: false

- name: Copy SpannerLib code
run: ./scripts/sync_spannerlib_node.sh false main
working-directory: handwritten/spanner-driver
shell: bash

- uses: googleapis/code-suggester@f9fef85aa02459e30e62526abe950341cbbd768b # v5
env:
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
with:
command: pr
upstream_owner: googleapis
upstream_repo: google-cloud-node
description: 'Update the Spanner Node.js driver with the latest spannerlib-node code from go-sql-spanner.'
title: 'chore(spanner-driver): sync spannerlib-node code'
message: 'chore(spanner-driver): sync spannerlib-node code'
branch: automated-spanner-lib-code-update
git_dir: '.'
force: true
43 changes: 43 additions & 0 deletions handwritten/spanner-driver/scripts/sync_spannerlib_node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

SKIP_CLONE=$1
SPANNER_LIB_BRANCH="${2:-main}"

if ! [ "$SKIP_CLONE" == "true" ]; then
git clone https://github.com/googleapis/go-sql-spanner.git --branch "$SPANNER_LIB_BRANCH"
fi

mkdir -p spannerlib-node
rm -rf spannerlib-node/*

cp -r go-sql-spanner/spannerlib/wrappers/spannerlib-node/* spannerlib-node/
mkdir -p spannerlib-node/shared
cp -r go-sql-spanner/spannerlib/shared/* spannerlib-node/shared/

# Update build-shared-lib.sh and binding.gyp paths for self-contained spannerlib-node
if [ -f "spannerlib-node/scripts/build-shared-lib.sh" ]; then
sed -i '' 's|\.\./\.\./\.\./shared|\.\./shared|g' spannerlib-node/scripts/build-shared-lib.sh 2>/dev/null || \
sed -i 's|\.\./\.\./\.\./shared|\.\./shared|g' spannerlib-node/scripts/build-shared-lib.sh
fi

if [ -f "spannerlib-node/binding.gyp" ]; then
sed -i '' 's|\.\./\.\./shared|\./shared|g' spannerlib-node/binding.gyp 2>/dev/null || \
sed -i 's|\.\./\.\./shared|\./shared|g' spannerlib-node/binding.gyp
fi

rm -rf go-sql-spanner
Loading