Skip to content

Fetch Design Tokens #3704

Fetch Design Tokens

Fetch Design Tokens #3704

Workflow file for this run

# This is a basic workflow that is manually triggered
name: Fetch Design Tokens
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "* 12 * * *"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job
fetchFigmaFileData:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Fetch light mode data
# You may pin to the exact commit or the version.
# uses: JamesIves/fetch-api-data-action@c38518c0358c6a522f0d4880212b65963e2d6574
uses: JamesIves/fetch-api-data-action@v2
with:
# The URL of the endpoint you would like to retrieve data from.
endpoint: https://api.figma.com/v1/files/RsXZaTPG4VeIZTSjQPSosc/styles
# Any applicable configuration settings that should be set such as authentication tokens. You can reference secrets using the secrets syntax, or you can reference data returned from the `TOKEN_ENDPOINT` request using the triple bracket syntax.
configuration: '{ "method": "GET", "headers": {"X-Figma-Token": "${{ secrets.FIGMA_API_KEY }}"} }'
set-output: false
save-name: light-mode
- name: Fetch dark mode data
# You may pin to the exact commit or the version.
# uses: JamesIves/fetch-api-data-action@c38518c0358c6a522f0d4880212b65963e2d6574
uses: JamesIves/fetch-api-data-action@v2
with:
# The URL of the endpoint you would like to retrieve data from.
endpoint: https://api.figma.com/v1/files/r2A9XUUQxda5FmgXSsqPU2/styles
# Any applicable configuration settings that should be set such as authentication tokens. You can reference secrets using the secrets syntax, or you can reference data returned from the `TOKEN_ENDPOINT` request using the triple bracket syntax.
configuration: '{ "method": "GET", "headers": {"X-Figma-Token": "${{ secrets.FIGMA_API_KEY }}"} }'
set-output: false
save-name: dark-mode
- name: Build and Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: main # Pushes the updates to the main branch.
folder: fetch-api-data-action # The location of the data.json file saved by the Fetch API Data action.
target-folder: data # Saves the data into the 'data' directory on the main branch.
commit-message: "chore: fetch design tokens from Figma"