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: Generate scss vars from figma tokens | |
on: | |
push: | |
paths: | |
- 'figma-tokens/input/**' | |
jobs: | |
transform_tokens: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
# Configuring Node.js Environment | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2.4.0 | |
# Setting dependencies | |
- name: Install dependencies | |
run: npm ci | |
# Token conversion using token-transformer | |
- name: Transform Figma tokens | |
run: npx token-transformer figma-tokens/input/tokens.json figma-tokens/input/tokens-transformed.json | |
build_tokens: | |
runs-on: ubuntu-latest | |
needs: [transform_tokens] | |
steps: | |
- name: Print working directory | |
run: pwd | |
# Run script for Style Dictionary, convert JSON to SCSS | |
- name: Build Figma tokens to SCSS | |
run: npm run build-tokens | |
commit_and_pull_request: | |
runs-on: ubuntu-latest | |
needs: [build_tokens] | |
steps: | |
# Automatically add and commit all changes including SCSS | |
- name: Auto commit updated tokens and SCSS | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "build: update SCSS variables and tokens" | |
file_pattern: stories/assets/scss/figma-scss/_figma-variables.scss | |
branch: update-figma-tokens # Commit to the new branch | |
# Automatic pull request | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: update-figma-tokens # Branch to be created for pull request | |
commit-message: "build: update SCSS variables from Figma tokens" | |
title: "Update SCSS variables from Figma tokens" | |
body: "This PR updates SCSS variables based on the latest Figma tokens." | |
base: develop | |
delete-branch: true # Delete branch after merge | |