-
Notifications
You must be signed in to change notification settings - Fork 55
63 lines (56 loc) · 2.1 KB
/
icons.yml
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
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@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
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@5e914681df9dc83aa4e4905692ca88beb2f9e91f #v7.0.5
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 }}