Skip to content

Download icons from Figma #69

Download icons from Figma

Download icons from Figma #69

Workflow file for this run

name: Download icons from Figma
on:
repository_dispatch:
workflow_dispatch:
permissions:
contents: write
deployments: read
pull-requests: write
jobs:
download:
runs-on: ubuntu-latest
name: Download icons from Figma
environment: main
defaults:
run:
working-directory: ./packages/icons
steps:
- name: Checkout sources
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0
with:
# Required when using a PAT for opening the PR
persist-credentials: false
- name: Use Node.js
uses: ./.github/actions/setup-node
- name: Download icons
run: npx @talend/figma-icons-downloader
env:
FIGMA_ACCESS_TOKEN: ${{ secrets.STORYBOOK_FIGMA_ACCESS_TOKEN }}
- name: Generate changeset & PR body
id: get-pr-body
run: |
cd ../..
git add ./packages/icons/src
while read STATUS ADDR
do
icon=`basename $ADDR .svg`
size=`basename $(dirname $ADDR)`
semver=`sed 's/A/minor/;s/D/major/;s/M/patch/' <<< $STATUS`
verb=`sed 's/A/added/;s/D/removed/;s/M/changed/' <<< $STATUS`
echo -e "---\n'@talend/icons': $semver\n---\n\n$verb icon \`$icon\` in size \`$size\`" > .changeset/$icon-$size-$semver.md
done < <(git diff --name-status HEAD ./packages/icons/src/icon/**/*.svg)
git add .changeset
body=$(git diff --name-only HEAD .changeset/*.md | xargs -L1 sed -n '5p')
body="${body//$'\n'/'%0A'}"
echo ::set-output name=body::$body
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 #v5.0.2
with:
commit-message: "chore(icons): from Figma"
title: "chore(icons): from Figma"
body: ${{ steps.get-pr-body.outputs.body }}
branch: ci/icons
token: ${{ secrets.GITHUB_TOKEN }}
# Opening a PR with default token would not start build & test action
GITHUB_TOKEN: ${{ secrets.CHANGESET_GITHUB_TOKEN }}