Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Refresh Connector Schema #20

Refresh Connector Schema

Refresh Connector Schema #20

name: Refresh Connector Schema
on:
workflow_dispatch:
schedule:
- cron: '0 13 1 * *'
jobs:
generate:
name: generate schema
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Install DaVinci CLI
run: cd tools && go install github.com/patrickcping/davinci-pingcli
continue-on-error: false
- name: Generate Connector Schema
run: |
davinci-pingcli connectors schema --json | jq '[.[] | .accountConfigView.items as $items | {"name": .name, "connectorId": .connectorId, "connectorCategories": .connectorCategories, "properties": (.properties // {} | with_entries(select(.key as $k | ($items // [] | map(.propertyName)) | index($k))))}] | sort_by(.connectorId)' > internal/generate/connector_schema/connector-schema.json
continue-on-error: false
env:
PINGCLI_DAVINCI_USERNAME: ${{ secrets.PINGCLI_DAVINCI_USERNAME }}
PINGCLI_DAVINCI_PASSWORD: ${{ secrets.PINGCLI_DAVINCI_PASSWORD }}
PINGCLI_DAVINCI_ADMINENVIRONMENTID: ${{ secrets.PINGCLI_DAVINCI_ADMIN_ENVIRONMENT_ID }}
PINGCLI_DAVINCI_ENVIRONMENTID: ${{ secrets.PINGCLI_DAVINCI_ENVIRONMENT_ID }}
PINGCLI_DAVINCI_REGION: ${{ secrets.PINGCLI_DAVINCI_REGION }}
- name: Check for changes
id: check_changes
run: |
git add -N .
if git diff --compact-summary --exit-code; then
echo "No changes detected"
else
echo "Changes detected"
echo "CONTENT_CHANGED=true" >> $GITHUB_OUTPUT
fi
continue-on-error: false
- name: Create new branch
id: create_branch
if: steps.check_changes.outputs.CONTENT_CHANGED == 'true'
run: |
branch_name="update-connector-schema-$(date +'%Y%m%d%H%M%S')"
echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
git checkout -b $branch_name
- name: Commit changes
id: commit_changes
if: steps.check_changes.outputs.CONTENT_CHANGED == 'true'
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "action@github.com"
git config --global push.autoSetupRemote true
git add .
git commit -m "Update connector schema"
git push
- name: Create PR
id: create_pr
if: steps.check_changes.outputs.CONTENT_CHANGED == 'true'
uses: actions/github-script@v7
env:
BRANCH_NAME: ${{ env.BRANCH_NAME }}
with:
script: |
const { BRANCH_NAME } = process.env
const { repo, owner } = context.repo;
const pr = await github.rest.pulls.create({
owner,
repo,
title: 'Update Connector Schema',
body: 'Connector Schema has changed. Please review.',
head: BRANCH_NAME,
base: 'main'
});