Skip to content

Commit 18bdb14

Browse files
committed
chore(spanner-driver): add spannerlib-node CGO auto-sync workflow and script
1 parent ca43580 commit 18bdb14

2 files changed

Lines changed: 78 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Sync SpannerLib Node code from go-sql-spanner
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
workflow_dispatch: # Allows manual triggering
9+
10+
jobs:
11+
sync-code:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
15+
with:
16+
persist-credentials: false
17+
18+
- name: Copy SpannerLib code
19+
run: ./scripts/sync_spannerlib_node.sh false main
20+
working-directory: handwritten/spanner-driver
21+
shell: bash
22+
23+
- uses: googleapis/code-suggester@f9fef85aa02459e30e62526abe950341cbbd768b # v5
24+
env:
25+
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
26+
with:
27+
command: pr
28+
upstream_owner: googleapis
29+
upstream_repo: google-cloud-node
30+
description: 'Update the Spanner Node.js driver with the latest spannerlib-node code from go-sql-spanner.'
31+
title: 'chore(spanner-driver): sync spannerlib-node code'
32+
message: 'chore(spanner-driver): sync spannerlib-node code'
33+
branch: automated-spanner-lib-code-update
34+
git_dir: '.'
35+
force: true
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -e
17+
18+
SKIP_CLONE=$1
19+
SPANNER_LIB_BRANCH="${2:-main}"
20+
21+
if ! [ "$SKIP_CLONE" == "true" ]; then
22+
git clone https://github.com/googleapis/go-sql-spanner.git --branch "$SPANNER_LIB_BRANCH"
23+
fi
24+
25+
mkdir -p spannerlib-node
26+
rm -rf spannerlib-node/*
27+
28+
cp -r go-sql-spanner/spannerlib/wrappers/spannerlib-node/* spannerlib-node/
29+
mkdir -p spannerlib-node/shared
30+
cp -r go-sql-spanner/spannerlib/shared/* spannerlib-node/shared/
31+
32+
# Update build-shared-lib.sh and binding.gyp paths for self-contained spannerlib-node
33+
if [ -f "spannerlib-node/scripts/build-shared-lib.sh" ]; then
34+
sed -i '' 's|\.\./\.\./\.\./shared|\.\./shared|g' spannerlib-node/scripts/build-shared-lib.sh 2>/dev/null || \
35+
sed -i 's|\.\./\.\./\.\./shared|\.\./shared|g' spannerlib-node/scripts/build-shared-lib.sh
36+
fi
37+
38+
if [ -f "spannerlib-node/binding.gyp" ]; then
39+
sed -i '' 's|\.\./\.\./shared|\./shared|g' spannerlib-node/binding.gyp 2>/dev/null || \
40+
sed -i 's|\.\./\.\./shared|\./shared|g' spannerlib-node/binding.gyp
41+
fi
42+
43+
rm -rf go-sql-spanner

0 commit comments

Comments
 (0)