Workflow configuration
Authentication and environment variables
The workflow requires several environment variables to be set:XATA_API_KEY
: Your Xata API key (set as a GitHub secret)XATA_ORGANIZATIONID
: Your Xata organization IDXATA_PROJECTID
: Your Xata project IDXATA_BRANCHID
: The ID of the main branchXATA_BRANCHNAME
: The name of the main branchXATA_DATABASENAME
: Your database nameXATA_CLI_SOURCE_POSTGRES_URL
: The source PostgreSQL database URL (set as a GitHub secret)
Workflow steps
1. Checkout code
2. Install Xata CLI
3. Check Xata status
4. Checkout clone branch
- Checks out the clone_demo branch
- Extracts the branch ID using
jq
- Stores it in an environment variable
5. Start clone process
Triggering the workflow
The workflow can be triggered in two ways:-
Scheduled run
Runs daily at 8:00 AM UTC
-
Manual trigger
Can be triggered manually from the GitHub Actions UI
Concurrency control
The workflow uses GitHub Actions concurrency to prevent multiple runs from interfering with each other:- Only one workflow run is active at a time
- New runs cancel any in-progress runs
- Prevents race conditions during cloning
Best practices
-
Set appropriate timeout
- The workflow has a 10-minute timeout
- Adjust based on your database size and cloning duration
-
Use environment variables
- Store sensitive information in GitHub secrets
- Use environment variables for configuration
-
Schedule regular clones
- Set up a schedule that matches your backup needs
- Consider your database size and update frequency
Related workflows
- Check workflow - For validating main branch status
- PR workflow - For managing pull request environments