Workflow configuration
Authentication and environment variables
The workflow requires several environment variables to be set:XATA_API_REFRESH_TOKEN
: Your Xata API refresh token (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 name
Workflow steps
1. Install Xata CLI
2. Check Xata status
- Verifies CLI and connection status
- Checks for any pending migrations
- Views the current branch status
Concurrency control
The workflow uses GitHub Actions concurrency to prevent multiple runs from interfering with each other:- Only one workflow run per branch is active at a time
- New runs cancel any in-progress runs
- Prevents race conditions during status checks
Best practices
-
Set appropriate timeout
- The workflow has a 10-minute timeout
- Adjust based on your maximum migration duration
-
Use environment variables
- Store sensitive information in GitHub secrets
- Use environment variables for configuration
-
Handle migration states
- Check for in-progress migrations
- Prevent merging during active migrations
- Provide clear error messages
Related workflows
- Clone workflow - For cloning databases in CI/CD
- PR workflow - For managing pull request environments