From 5aab78239d42024e2f6d0f852c77afbdf780a933 Mon Sep 17 00:00:00 2001 From: m2rt Date: Wed, 18 Mar 2026 09:51:51 +0200 Subject: [PATCH] feat(variables): added variable update workflow #78 --- .github/workflows/sync-figma-variables.yml | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/sync-figma-variables.yml diff --git a/.github/workflows/sync-figma-variables.yml b/.github/workflows/sync-figma-variables.yml new file mode 100644 index 00000000..f22bfe97 --- /dev/null +++ b/.github/workflows/sync-figma-variables.yml @@ -0,0 +1,63 @@ +name: Sync Figma Variables + +on: + schedule: + - cron: "0 7,15 * * 1-5" # Weekdays at 09:00 and 17:00 UTC+2 + workflow_dispatch: # Allow manual trigger from GitHub UI + +concurrency: + group: sync-figma-variables + cancel-in-progress: true + +permissions: + contents: write + pull-requests: write + +jobs: + sync-variables: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: rc + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Import Figma variables + env: + FIGMA_VARIABLE_TOKEN: ${{ secrets.FIGMA_VARIABLE_TOKEN }} + FIGMA_FILE_KEY: ${{ secrets.FIGMA_FILE_KEY }} + run: npx ts-node scripts/variable-exporter.ts + + - name: Check for changes + id: changes + run: | + if git diff --quiet; then + echo "changed=false" >> "$GITHUB_OUTPUT" + else + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Create Pull Request + if: steps.changes.outputs.changed == 'true' + uses: peter-evans/create-pull-request@v7 + with: + branch: chore/sync-figma-variables + commit-message: "chore(variables): update variables from Figma #69" + title: "chore(variables): update variables from Figma" + body: | + ## Summary + - Automated sync of variables from Figma variables API + - Run triggered by: ${{ github.event_name == 'schedule' && 'scheduler' || 'manual dispatch' }} + + Review the diff to verify variable changes match what was updated in Figma. + base: rc + delete-branch: true