Skip to content

Update icons

Update icons #428

Workflow file for this run

name: Update icons
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1-5'
jobs:
update-icons:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: peterjgrainger/action-create-branch@v2.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'update-icons'
- uses: actions/checkout@v2
with:
ref: 'update-icons'
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Export icons from Figma
run: ./tools/export-icons.sh
env:
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }}
- name: Commit icon file updates (if any)
uses: EndBug/add-and-commit@v9
with:
add: ./libs/ui/lib/icons
message: 'Pull icon updates from figma'
default_author: github_actions
new_branch: update-icons
- name: Check if icon files have changed
id: icon-files-changed
uses: tj-actions/changed-files@v18.1
with:
files: |
libs/ui/lib/icons
- name: Create PR if it doesn't exist
if: steps.icon-files-changed.outputs.any_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ $(gh pr list --json "url" -q ".[].url" --head update-icons | wc -c) -eq 0 ]]; then
gh pr create --base main --head update-icons --title "Sync icon updates from figma" --body "This PR is generated by 'update-icons.yaml' when icon changes are made to tokens.json"
fi