GitHub Actions Integration
Automatically sync your design tokens to your repository using GitHub Actions.Basic Workflow
Create.github/workflows/sync-tokens.yml:
Setup Steps
1. Create GitHub Secrets
Go to your repository → Settings → Secrets and variables → Actions Add these secrets:| Secret Name | Value | Example |
|---|---|---|
TOKENCRAFT_TOKEN | Your API token | dtk_abc123... |
TOKENCRAFT_API_BASE | API base URL | https://app.tokencraft.dev/api/v1 |
TOKENSET_ID | Tokenset ID | tokenset-123 |
MODE_ID | Mode ID | mode-light |
2. Create Workflow File
Add the workflow file to your repository:3. Test the Workflow
Trigger manually from GitHub:- Go to Actions tab
- Select “Sync Design Tokens”
- Click “Run workflow”
Advanced Workflows
Multi-Mode Sync
Sync both light and dark modes:Multi-Format Export
Export in multiple formats:With Pull Request
Create a PR instead of direct commit:With Slack Notification
Notify on updates:Mobile App Workflows
iOS
Android
Best Practices
1. Use Branch Protection
Prevent direct pushes to main:2. Add Validation
Validate tokens before committing:3. Cache Dependencies
Speed up workflows:4. Skip CI on Token Updates
Avoid infinite loops:Troubleshooting
Authentication Failed
Error:401 Unauthorized
Solution:
- Verify
TOKENCRAFT_TOKENsecret is set - Check token hasn’t been revoked
- Ensure no extra spaces in secret value
File Not Found
Error:curl: failed to write
Solution:
Create directory first:
No Changes to Commit
Error:nothing to commit
Solution:
Use conditional commit: