Update icons #648
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update icons | |
on: | |
schedule: | |
- cron: "0 10 * * *" | |
workflow_dispatch: | |
env: | |
new_files: false | |
jobs: | |
cron-update-icons: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Node | |
uses: ./.github/actions/node | |
- name: Today date | |
run: echo "TODAY=$(date '+%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Setup git identity | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Update icons | |
run: | | |
yarn components fetch:icons | |
git add --all | |
if git diff-index --quiet HEAD; then | |
echo "No changes to icons. Exiting." | |
echo "new_files=false" >> $GITHUB_ENV | |
else | |
git checkout -b feat/update-icons-and-svgs | |
git commit -m "feat(icons): update icons from figma" | |
git push origin feat/update-icons-and-svgs | |
echo "new_files=true" >> $GITHUB_ENV | |
fi | |
env: | |
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }} | |
- uses: actions/checkout@v4 | |
- name: Create PR | |
uses: peter-evans/create-pull-request@v6 | |
# uses: actions/github-script@v6 | |
if: env.new_files == 'true' | |
with: | |
token: ${{ secrets.PAT }} | |
commit-message: "feat(icons): update icons from Figma" | |
title: "feat(icons): update icons from Figma" | |
body: "- Automatically generated PR on ${process.env.TODAY}.\n- Updates icons from Figma" | |
branch: feat/update-icons-and-svgs | |
# with: | |
# script: | | |
# github.rest.pulls.create({ | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# head: 'feat/update-icons-and-svgs', | |
# base: 'master', | |
# title: 'feat(icons): update icons from Figma', | |
# body: `- Automatically generated PR on ${process.env.TODAY}.\n- Updates icons from Figma`, | |
# maintainer_can_modify: true, | |
# }); |