Skip to content

Sync Examples from Connectors #564

Sync Examples from Connectors

Sync Examples from Connectors #564

name: Sync Examples from Connectors
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Clone connectors mono-repo
run: |
git clone --depth 1 https://github.com/awslabs/aurora-dsql-connectors.git /tmp/connectors
- name: Sync Python examples
run: |
rsync -av --delete --exclude='*no_connector*' --exclude='README.md' /tmp/connectors/python/connector/examples/psycopg/src/ python/psycopg/src/
rsync -av --delete --exclude='*no_connector*' /tmp/connectors/python/connector/examples/psycopg/test/ python/psycopg/test/
rsync -av --delete --exclude='*no_connector*' --exclude='README.md' /tmp/connectors/python/connector/examples/psycopg2/src/ python/psycopg2/src/
rsync -av --delete --exclude='*no_connector*' /tmp/connectors/python/connector/examples/psycopg2/test/ python/psycopg2/test/
rsync -av --delete --exclude='*no_connector*' --exclude='README.md' /tmp/connectors/python/connector/examples/asyncpg/src/ python/asyncpg/src/
rsync -av --delete --exclude='*no_connector*' /tmp/connectors/python/connector/examples/asyncpg/test/ python/asyncpg/test/
- name: Sync Node.js examples
run: |
rsync -av --delete --exclude='*no_connector*' --exclude='README.md' /tmp/connectors/node/node-postgres/example/src/ javascript/node-postgres/src/
rsync -av --delete --exclude='*no_connector*' /tmp/connectors/node/node-postgres/example/test/ javascript/node-postgres/test/
rsync -av --delete --exclude='*no_connector*' --exclude='README.md' /tmp/connectors/node/postgres-js/example/src/ javascript/postgres-js/src/
rsync -av --delete --exclude='*no_connector*' /tmp/connectors/node/postgres-js/example/test/ javascript/postgres-js/test/
- name: Sync Java examples
run: |
rsync -av --delete --exclude='*NoConnector*' --exclude='README.md' /tmp/connectors/java/jdbc/examples/pgjdbc/src/ java/pgjdbc/src/
- name: Sync Go examples
run: |
rsync -av --delete --exclude='README.md' /tmp/connectors/go/pgx/example/src/ go/pgx/src/
rsync -av --delete --exclude='README.md' /tmp/connectors/go/pgx/example/test/ go/pgx/test/
# Update import paths in test files from connector repo to samples repo
find go/pgx/test -name '*.go' -exec sed -i 's|github.com/awslabs/aurora-dsql-connectors/go/pgx/example/src|github.com/aws-samples/aurora-dsql-samples/go/pgx/src|g' {} +
- name: Sync Ruby examples
run: |
rsync -av --delete --exclude='*no_connector*' --exclude='README.md' /tmp/connectors/ruby/pg/example/src/ ruby/ruby-pg/src/
rsync -av --delete --exclude='*no_connector*' /tmp/connectors/ruby/pg/example/test/ ruby/ruby-pg/test/
- name: Sync Dotnet examples
run: |
rsync -av --delete --exclude='README.md' /tmp/connectors/dotnet/npgsql/example/src/ dotnet/npgsql/src/
rsync -av --delete /tmp/connectors/dotnet/npgsql/example/test/ dotnet/npgsql/test/
- name: Sync Rust examples
run: |
rsync -av --delete --exclude='README.md' /tmp/connectors/rust/sqlx/example/src/ rust/sqlx/src/
rsync -av --delete /tmp/connectors/rust/sqlx/example/tests/ rust/sqlx/tests/
- name: Sync PHP examples
run: |
rsync -av --delete --exclude='README.md' --exclude='composer.json' /tmp/connectors/php/pdo_pgsql/example/src/ php/pdo-pgsql/src/
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v8
with:
commit-message: "Sync examples from connectors"
title: "Sync examples from connectors"
body: "Automated sync from connector repos"
branch: sync/connectors
delete-branch: true
- name: Enable auto-merge
if: steps.cpr.outputs.pull-request-number
run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ github.token }}