-
Notifications
You must be signed in to change notification settings - Fork 10
99 lines (85 loc) · 3.23 KB
/
sync-icons.yml
File metadata and controls
99 lines (85 loc) · 3.23 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
name: Sync icons
on:
workflow_dispatch:
inputs:
full_sync:
description: 'Re-download existing icon SVGs'
type: boolean
default: false
jobs:
sync-icons:
if: github.repository == 'launchdarkly/launchpad-ui'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- name: Get Tokens
uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: |
/production/common/launchpad-ui/gh-pat-token = CUSTOM_GITHUB_TOKEN,
/production/common/launchpad-ui/figma-access-token = FIGMA_ACCESS_TOKEN
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ env.CUSTOM_GITHUB_TOKEN }}
persist-credentials: false
- name: Setup PNPM
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Sync Icons
run: pnpm nx run @launchpad-ui/icons:${{ inputs.full_sync && 'sync:full' || 'sync' }}
- name: Connect Icons
run: pnpm nx run @launchpad-ui/icons:connect
- name: Detect changes
id: changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Create changeset
id: create-changeset
if: steps.changes.outputs.changed == 'true'
run: npx changeset add --empty
- name: Write to created changeset file
if: steps.changes.outputs.changed == 'true'
run: |
CHANGESET_FILE=$(ls -t .changeset/*.md | head -n1)
CHANGE_TYPE="---\n\"@launchpad-ui/icons\": patch\n---"
CHANGE_SUMMARY="feat(icons): sync and connect icons with figma library\n${{ env.CHANGESET_SUMMARY }}"
echo -e "$CHANGE_TYPE\n\n$CHANGE_SUMMARY" > $CHANGESET_FILE
- name: Create Pull Request
if: steps.changes.outputs.changed == 'true'
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6
with:
branch: ci/feat/sync-icons
delete-branch: true
commit-message: |
feat(icons): sync and connect icons with figma library
${{ env.CHANGESET_SUMMARY }}
title: "feat(icons): sync and connect icons with figma library"
token: ${{ env.CUSTOM_GITHUB_TOKEN }}
draft: true
body: |
## Summary
This PR is an automated icon sync with LaunchPad Figma library. If you resync while this PR is open, the updated changes will be added to this same PR.
${{ env.CHANGESET_SUMMARY }}
labels: |
icons
ci
assignees: ${{ github.actor }}
- name: No-op (when no changes to icons)
if: steps.changes.outputs.changed != 'true'
run: echo "No changes detected, skipping changeset and PR creation."