Skip to main content

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:

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:
  1. Verify TOKENCRAFT_TOKEN secret is set
  2. Check token hasn’t been revoked
  3. 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:

Example: Complete Production Workflow

Next Steps

JavaScript Integration

Use tokens in your app

API Reference

Export API documentation