-
Notifications
You must be signed in to change notification settings - Fork 13
122 lines (102 loc) · 4.49 KB
/
import-figma-assets.yml
File metadata and controls
122 lines (102 loc) · 4.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Import Figma assets
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * *" # run daily at 6 am
env:
TURBO_TOKEN: ${{ secrets.TURBO_REMOTE_CACHE__TURBO_TOKEN }}
permissions:
contents: read
jobs:
import_icons:
name: Import Figma icons
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: "🛃 Harden the runner (Audit all outbound calls)"
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: "🛒 Checkout Repository"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/templates/node-setup
- name: 🛠️ Build Figma utils
run: pnpm run build
working-directory: packages/figma-utils
# delete all icons before importing them so no longer existing or renamed icons are removed
- name: Clear icons
run: rm -rfv src/assets/*
working-directory: packages/icons
- name: Import icons
run: |
pnpm run @sit-onyx/figma-utils import-icons -k "${{ vars.FIGMA_FILE_KEY_ICONS }}" -t "${{ secrets.FIGMA_TOKEN }}" -p "${{ vars.FIGMA_ICON_PAGE_ID }}" -d "../icons/src/assets" -m "../icons/src/metadata.json"
working-directory: packages/figma-utils
- name: Generate changeset
run: |
git add .
pnpm run generate:changeset
working-directory: packages/icons
# needed to prevent creating empty PR when nothing but the formatting changed
- name: Format with prettier
run: pnpm prettier --write src/metadata.json
working-directory: packages/icons
- name: Create pull request
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
commit-message: "feat: update Figma icons"
title: "feat: update Figma icons"
body: |
This is an auto-generated pull request.
All icons have been imported from the [Figma file](https://www.figma.com/design/${{ vars.FIGMA_FILE_KEY_ICONS }}?node-id=${{ vars.FIGMA_ICON_PAGE_ID }}).
branch-suffix: random # needed to not override other pull requests created via workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: ${{ github.ref_name }}
import_flags:
name: Import Figma flags
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: "🛃 Harden the runner (Audit all outbound calls)"
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: "🛒 Checkout Repository"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/templates/node-setup
- name: 🛠️ Build Figma utils
run: pnpm run build
working-directory: packages/figma-utils
# delete all flags before importing them so no longer existing or renamed flags are removed
- name: Clear flags
run: rm -rfv src/assets/*
working-directory: packages/flags
- name: Import flags
run: |
pnpm run @sit-onyx/figma-utils import-flags -k "${{ vars.FIGMA_FILE_KEY }}" -t "${{ secrets.FIGMA_TOKEN }}" -p "${{ vars.FIGMA_FLAG_PAGE_ID }}" -d "../flags/src/assets" -m "../flags/src/metadata.json"
working-directory: packages/figma-utils
- name: Generate changeset
run: |
git add .
pnpm run generate:changeset
working-directory: packages/flags
# needed to prevent creating empty PR when nothing but the formatting changed
- name: Format with prettier
run: pnpm prettier --write src/metadata.json
working-directory: packages/flags
- name: Create pull request
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
commit-message: "feat: update Figma flags"
title: "feat: update Figma flags"
body: |
This is an auto-generated pull request.
All flags have been imported from the [Figma file](https://www.figma.com/design/${{ vars.FIGMA_FILE_KEY }}?node-id=${{ vars.FIGMA_FLAG_PAGE_ID }}).
branch-suffix: random # needed to not override other pull requests created via workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: ${{ github.ref_name }}