Skip to content

Build Tokens Package #42

Build Tokens Package

Build Tokens Package #42

Workflow file for this run

# Builds the tokens package to update the figma folder
name: 'Build Tokens Package'
on:
workflow_dispatch:
push:
paths: ['packages/tokens/**']
branches:
- main
env:
FILES_MODIFIED:
jobs:
tokens-build:
name: Build (fails by design)
# id: tokens-build
runs-on: ubuntu-latest
# continue-on-error: true
# outputs:
# figma-noDiff: steps.noDiff.outputs.test
# figma-built: steps.built.output.test
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.VA_MOBILE_ROBOT_GITHUB_PAT }}
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
registry-url: https://registry.npmjs.org/
node-version-file: .nvmrc
cache: yarn
cache-dependency-path: yarn.lock
- run: yarn install
- name: Build tokens
run: |
yarn tokens:build
- name: Prepare commit
working-directory: packages/tokens
run: |
git config --global user.name 'VA Automation Bot'
git config --global user.email 'va-mobileapp@adhocteam.us'
git pull
git add -f figma/
- name: Check figma diff
id: diff
working-directory: packages/tokens
run: |
echo $FILES_MODIFIED
echo "FILES_MODIFIED=git status --porcelain 2>/dev/null| egrep "^(M| M|D| D)" | wc -l" >> $GITHUB_ENV
- name: No changes to figma tokens
if: ${{ env.FILES_MODIFIED == '0' }}
run: |
echo $FILES_MODIFIED
echo No changes to figma tokens
# run: |
# echo 'test=noDiff' >> 'No changes to figma tokens'
- name: Commit latest figma tokens
id: built
if: ${{ env.FILES_MODIFIED == '1' }}
working-directory: packages/tokens
run: |
echo $FILES_MODIFIED
exit 1
git commit -m 'Build latest figma tokens'
git push
- name: Set success/fail
if: ${{ env.FILES_MODIFIED >= '2' }}
run: fail 1