Integration · CI/CD

Masked and synthetic test data in GitHub Actions

Refresh a test database before your tests run, on a schedule or on demand. A GitHub Actions job can start a Synthesized workflow through the REST API, run the TDK CLI as a Docker image, or use the Run Synthesized TDK action from the Marketplace.

GitHub Actions and Synthesized at a glance

Three ways to connect, all described in the Synthesized documentation.

ApproachHow it worksBest for
Trigger a Governor workflowThe job calls POST /external/api/v1/workflow/{id}/run, polls the run status and fails the job if the run fails. The workflow is built and run in Governor, and the run appears in its history.Shared workflows, licensed features, internal databases (with a self-hosted runner)
Run the TDK CLI imageThe job runs synthesizedio/synthesized-tdk-cli with a config.yaml from the repository. The runner connects to both databases directly.Configuration kept in Git and reviewed in pull requests
Run Synthesized TDK actionsynthesized-io/tdk-gha@v1 runs the free CLI. Inputs: input_url, input_username, input_password, output_url, output_username, output_password, user_config.Trials and small databases (free mode has limits)

Set it up

For the Governor approach, which most teams use in production:

1. Build the workflow in Governor

Create the masking, subsetting or generation workflow in the Governor web UI and run it once by hand, so you know it works and have its workflow ID.

2. Create a key for the pipeline

Generate an access key as a Governor user that can reach only this workflow. Save it as the repository secret GOVERNOR_ACCESS_KEY, and the Governor address and workflow ID as the variables GOVERNOR_URL and MASK_WORKFLOW_ID.

3. Add the data job

Add a job that starts the run and waits for it, as in the example below. The runner must reach Governor over HTTPS, so use a self-hosted runner if Governor is internal.

4. Make tests depend on it

Run your test job with needs: refresh, so it starts only after the data is ready.

Example workflow

A nightly refresh at 02:00 UTC that can also be started by hand. The step starts the Governor workflow, polls until it finishes, and prints the end of the log if it fails.

.github/workflows/refresh-test-data.yml

name: Refresh test data
on:
schedule:
- cron: "0 2 * * *"
workflow_dispatch:
 
jobs:
refresh:
runs-on: ubuntu-latest # use a self-hosted runner if Governor is internal
timeout-minutes: 60
env:
GOVERNOR_URL: ${{ vars.GOVERNOR_URL }}
WORKFLOW_ID: ${{ vars.MASK_WORKFLOW_ID }}
GOVERNOR_ACCESS_KEY: ${{ secrets.GOVERNOR_ACCESS_KEY }}
steps:
- uses: actions/checkout@v4
- name: Run Synthesized workflow
run: sh ./scripts/run-synthesized-workflow.sh
 
tests:
needs: refresh
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm test

scripts/run-synthesized-workflow.sh

#!/bin/sh
# run-synthesized-workflow.sh: start a Synthesized workflow and wait for it.
# Needs GOVERNOR_URL, WORKFLOW_ID and GOVERNOR_ACCESS_KEY; uses curl and jq.
set -eu
API="$GOVERNOR_URL/external/api/v1"
AUTH="X-Access-Key: $GOVERNOR_ACCESS_KEY"
TIMEOUT_SEC="${TIMEOUT_SEC:-1800}"
 
RUN=$(curl -sSf -X POST -H "$AUTH" "$API/workflow/$WORKFLOW_ID/run")
RUN_ID=$(printf '%s' "$RUN" | jq -r '.workflow_run_id')
echo "Started workflow run $RUN_ID"
 
WAITED=0
while [ "$WAITED" -lt "$TIMEOUT_SEC" ]; do
RUN=$(curl -sSf -H "$AUTH" "$API/workflow-run/$RUN_ID")
STATUS=$(printf '%s' "$RUN" | jq -r '.workflow_run_status')
case "$STATUS" in
COMPLETED) echo "Test data ready"; exit 0 ;;
FAILED|STOPPED)
echo "Run $RUN_ID ended as $STATUS: $(printf '%s' "$RUN" | jq -r '.error_message')"
curl -sS -H "$AUTH" "$API/workflow-run/$RUN_ID/logs" | tail -n 50
exit 1 ;;
esac
sleep 10
WAITED=$((WAITED + 10))
done
echo "Timed out after $TIMEOUT_SEC seconds; stopping workflow $WORKFLOW_ID"
curl -sS -X POST -H "$AUTH" "$API/workflow/$WORKFLOW_ID/stop" || true
exit 1

The same script works in any CI tool; see the REST API page for every endpoint and run status.

Things to know

Use a dedicated key

An access key carries the permissions of the Governor user who generated it. Create a user that can reach only the workflows this pipeline runs, generate the key as that user, and give it a short expiry: keys are chosen from 1 hour to a year, and the docs say they can't yet be revoked.

One output database per environment

Two runs can't write to the same output database at the same time. If parallel pipelines or branches need data, give each environment its own workflow or output database.

Where the data goes

Workers read the source, mask, subset or generate, and write the target. Database contents stay with the workers and aren't sent to Governor, which, like the pipeline, only sees run status, logs and configuration. Run Synthesized on-premises, including air-gapped, and the data never leaves your environment; it is also available as SaaS.

Validate configuration in pull requests

If you use the CLI approach, run the configuration check on pull requests that change config.yaml, so errors show up before the nightly run.

Questions about GitHub Actions and Synthesized

Does Synthesized have a GitHub Action?

Yes. Run Synthesized TDK (synthesized-io/tdk-gha@v1) runs the free TDK CLI in a job, with the input and output database connections and a YAML configuration as inputs. Free mode has limits on some data sources and data sizes; for production-scale work, trigger a Governor workflow through the REST API instead.

Which approach should I use?

Trigger a Governor workflow when the workflow is shared with other teams or tools, needs a licence, or should keep its run history in one place. Run the CLI image when the configuration lives in the repository and the runner can reach both databases. Use the Marketplace action for quick trials and small databases.

Can I use GitHub-hosted runners?

Only if Governor, or for the CLI approach both databases, can be reached from the internet. For an internal Governor, use a self-hosted runner inside your network.

Can I refresh test data every night?

Yes. Add a schedule trigger with a cron expression, for example 0 2 * * * for 02:00 UTC, and keep workflow_dispatch so the team can also start it by hand.

How do the tests wait for the data?

Put the data step in its own job and make the test job depend on it with needs. The data job fails if the run ends as FAILED or STOPPED, so the tests don't run on stale data.

Try it on one pipeline

Bring one pipeline that waits on test data, and see a Synthesized workflow refresh it before the tests run.

Updated November 2026

GitHub and GitHub Actions are trademarks of GitHub, Inc. All other product names are trademarks of their respective owners.