Sync Figma variables to tokens (and code) #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Figma variables to tokens (and code) | |
on: | |
workflow_dispatch: | |
inputs: | |
file_key: | |
description: 'The file key of the Figma file to be updated' | |
required: true | |
jobs: | |
sync-figma-to-tokens: | |
runs-on: ubuntu-latest | |
permissions: | |
# Need to be able to create new branches and commits | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.16.0' | |
- name: Set NPM version | |
run: npm install -g [email protected] | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: npm install | |
- name: Install Style Dictionary | |
run: npm install -g style-dictionary | |
- name: Clear tokens directory for demo | |
run: bash cleanup.sh | |
- name: Sync variables in Figma file to tokens | |
run: npm run sync-figma-to-tokens -- --output tokens | |
env: | |
FILE_KEY: ${{ github.event.inputs.file_key }} | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_ACTION_VARIABLES_SYNC_FIGMA_TOKEN }} | |
- name: Remove dollar signs from output (SD won't work otherwise) | |
run: bash removedollarsigns.sh | |
- name: Build Style Dictionary (uses config.json to define src/dest) | |
run: npm run build | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: Update tokens from Figma | |
title: Update tokens from Figma | |
body: 'Update tokens from Figma from file: https://www.figma.com/file/${{ github.event.inputs.file_key }}' | |
branch: update-tokens |