A GitHub Action for exporting Figma assets using ExFig CLI. Export colors, icons, images, and typography from Figma to your codebase with built-in caching.
- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
cache: true| Input | Description | Required | Default |
|---|---|---|---|
figma_token |
Figma Personal Access Token | Yes | - |
command |
ExFig command: colors, icons, images, typography, batch, fetch, download |
Yes | - |
config |
Path to exfig.yml config file | No | exfig.yml |
filter |
Filter pattern for assets (e.g., icon/*) |
No | - |
version |
ExFig version to use | No | latest |
cache |
Enable caching for incremental exports | No | false |
cache_path |
Path to cache file | No | .exfig-cache.json |
cache_key_prefix |
Prefix for cache key | No | exfig-cache |
granular_cache |
Enable experimental granular caching | No | false |
rate_limit |
Figma API rate limit (requests/second) | No | 10 |
max_retries |
Maximum retries for failed API requests | No | 3 |
output_dir |
Output directory for exported assets | No | - |
verbose |
Enable verbose logging | No | false |
extra_args |
Additional CLI arguments to pass to ExFig (e.g., --force --dry-run) |
No | - |
| Output | Description |
|---|---|
assets_exported |
Number of assets exported |
changed_files |
List of changed files (newline-separated) |
cache_hit |
Whether cache was restored |
Export icons with caching:
name: Export Figma Icons
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Daily
jobs:
export:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
cache: true
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git diff --staged --quiet || git commit -m "Update icons from Figma"
git pushjobs:
export:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Export colors
uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: colors
cache: true
cache_key_prefix: exfig-colors
- name: Export icons
uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
cache: true
cache_key_prefix: exfig-icons
- name: Export typography
uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: typography
cache: true
cache_key_prefix: exfig-typography- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
filter: 'navigation/*'
cache: true- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
version: 'v1.2.0'Pass additional flags directly to ExFig CLI:
- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
extra_args: '--force'jobs:
export:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: iconsThe action supports two levels of caching:
The ExFig binary is automatically cached per OS and version to avoid re-downloading on every run.
When cache: true, the action uses ExFig's built-in cache to enable incremental exports. Only changed assets are re-exported, significantly reducing Figma API calls and export time.
- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
cache: true
cache_path: '.exfig-cache.json' # Default
cache_key_prefix: 'exfig-cache' # DefaultThe cache is saved even on failure to support checkpoint resume for large exports.
For better performance with large asset libraries:
- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
cache: true
granular_cache: true- Ubuntu (Linux x64)
- macOS (Universal binary: arm64 + x86_64)
Create an exfig.yml in your repository root:
figma:
file_key: YOUR_FIGMA_FILE_KEY
icons:
page: Icons
output: src/assets/icons
format: svg
colors:
page: Colors
output: src/styles/colors.json
typography:
page: Typography
output: src/styles/typography.jsonSee ExFig documentation for full configuration options.
Error: Request failed with status 403
Ensure your FIGMA_TOKEN secret has read access to the Figma file.
Error: Rate limit exceeded
Reduce rate_limit input or wait before retrying:
- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
rate_limit: 5
max_retries: 6Ensure caching is enabled and the cache path is accessible:
- uses: alexey1312/exfig-action@v1
with:
figma_token: ${{ secrets.FIGMA_TOKEN }}
command: icons
cache: true
verbose: true # Enable verbose logging to debugMIT License - see LICENSE for details.