This documentation is available to agents as Markdown at https://docs.synthesized.io/tdk/latest/user_guide/070_integrations/cicd/github_actions.md. For the complete documentation index, see llms.txt.

GitHub Actions

A GitHub Actions workflow can refresh test data on a schedule, before tests, or on demand. Choose how it runs the platform: through Governor’s REST API, with the TDK CLI image, or with the free Run Synthesized TDK action.

Option Use it when

Trigger a Governor workflow

The workflow is built and managed in Governor, and Governor’s workers can reach the databases.

Run the TDK CLI image

The configuration lives in your repository, and the runner can reach the databases. Uses your license key.

Use the Run Synthesized TDK action

You want to try the platform in a pipeline, within free mode’s limits.

Keep passwords, access keys and the license key in GitHub secrets, never in the workflow file.

Trigger a Governor workflow

The job starts a run through Governor’s REST API, polls it until it finishes, and prints the end of the log if it fails.

Before you start:

  • Build the workflow in Governor and run it once. Note its ID.

  • Generate an access key as a dedicated user that can reach only the workflows this pipeline runs. Save it as the secret GOVERNOR_ACCESS_KEY.

  • Save Governor’s address, for example https://governor.example.com, as the variable GOVERNOR_URL, and the workflow ID as MASK_WORKFLOW_ID.

  • The runner must reach Governor over HTTPS. For a Governor inside your network, use a self-hosted runner.

# .github/workflows/refresh-test-data.yml
name: Refresh test data

on:
  schedule:
    - cron: '0 2 * * *'   # every day at 02:00 UTC
  workflow_dispatch:

jobs:
  refresh:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - name: Run the masking workflow in Governor
        env:
          BASE: ${{ vars.GOVERNOR_URL }}/external/api/v1
          ACCESS_KEY: ${{ secrets.GOVERNOR_ACCESS_KEY }}
          WORKFLOW_ID: ${{ vars.MASK_WORKFLOW_ID }}
        run: |
          set -euo pipefail
          RUN_ID=$(curl -sf -X POST "$BASE/workflow/$WORKFLOW_ID/run" \
            -H "X-Access-Key: $ACCESS_KEY" | jq -r '.workflow_run_id')
          echo "Started run $RUN_ID"
          while true; do
            STATUS=$(curl -sf "$BASE/workflow-run/$RUN_ID" \
              -H "X-Access-Key: $ACCESS_KEY" | jq -r '.workflow_run_status')
            case "$STATUS" in
              COMPLETED) echo "Run $RUN_ID completed"; exit 0 ;;
              FAILED|STOPPED)
                echo "Run $RUN_ID ended with status $STATUS"
                curl -sf "$BASE/workflow-run/$RUN_ID/logs" \
                  -H "X-Access-Key: $ACCESS_KEY" | tail -n 50
                exit 1 ;;
              *) sleep 15 ;;
            esac
          done

The run also appears in the workflow’s run history in Governor, with the same ID.

Run the TDK CLI image

The job runs the Docker image of the TDK CLI with a configuration from your repository. Save the database passwords and SYNTHESIZED_KEY as secrets, and the URLs and user names as variables.

# .github/workflows/mask-test-data.yml
name: Mask test data

on:
  workflow_dispatch:

jobs:
  mask:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run the TDK CLI
        env:
          SYNTHESIZED_KEY: ${{ secrets.SYNTHESIZED_KEY }}
          SYNTHESIZED_INPUT_URL: ${{ vars.INPUT_URL }}
          SYNTHESIZED_INPUT_USERNAME: ${{ vars.INPUT_USERNAME }}
          SYNTHESIZED_INPUT_PASSWORD: ${{ secrets.INPUT_PASSWORD }}
          SYNTHESIZED_OUTPUT_URL: ${{ vars.OUTPUT_URL }}
          SYNTHESIZED_OUTPUT_USERNAME: ${{ vars.OUTPUT_USERNAME }}
          SYNTHESIZED_OUTPUT_PASSWORD: ${{ secrets.OUTPUT_PASSWORD }}
        run: |
          docker run --rm \
            -v "$PWD/config.yaml:/app/config.yaml" \
            -e SYNTHESIZED_USERCONFIG_FILE=/app/config.yaml \
            -e SYNTHESIZED_KEY \
            -e SYNTHESIZED_INPUT_URL -e SYNTHESIZED_INPUT_USERNAME -e SYNTHESIZED_INPUT_PASSWORD \
            -e SYNTHESIZED_OUTPUT_URL -e SYNTHESIZED_OUTPUT_USERNAME -e SYNTHESIZED_OUTPUT_PASSWORD \
            synthesizedio/synthesized-tdk-cli:<version>

Replace <version> with the release you run, such as v1.184.0. The -e NAME form passes each variable from the step’s environment, so the secrets don’t appear in the command. For every variable the image reads, see CLI Docker Environment Variables.

Use the Run Synthesized TDK action

The Run Synthesized TDK action, synthesized-io/tdk-gha, runs the TDK CLI in free mode, without a license key. Free mode blocks some data sources and limits the size of others: see License.

- uses: synthesized-io/tdk-gha@v1
  with:
    input_url: jdbc:postgresql://input-db-host:5432/postgres
    input_username: tdk
    input_password: ${{ secrets.input_db_password }}
    output_url: jdbc:postgresql://output-db-host:5432/postgres
    output_username: tdk
    output_password: ${{ secrets.output_db_password }}
    user_config: |
      default_config:
        mode: MASKING
      schema_creation_mode: DROP_AND_CREATE

user_config is the workflow configuration. DROP_AND_CREATE recreates the output’s tables on each run, which suits a throwaway test database. The runner must reach both databases; for databases that live only for one run, use service containers.