Skip to content

Update Fonts List #1003

Update Fonts List

Update Fonts List #1003

name: Update Fonts List
on:
schedule:
- cron: '0 9 * * *'
workflow_dispatch:
jobs:
get-fonts-list:
runs-on: ubuntu-latest
env:
PULL_REQUEST_TITLE: Update fonts list
if:
steps:
- uses: actions/checkout@v3
- name: Check unmerged PR
id: check_unmerged_pr
run: |
if [[ $(gh pr list --state open --json title | jq '.[].title' | grep "${{ env.PULL_REQUEST_TITLE }}") ]]; then
echo "There is an open PR"
exit 1
fi
- name: Get Date
run: echo "TODAY=$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Fetch Fonts List
env:
GOOGLE_FONTS_API_KEY: ${{ secrets.GOOGLE_FONTS_API_KEY }}
run: |
curl -o ./src/assets/font-list.json \
"https://www.googleapis.com/webfonts/v1/webfonts?key=${GOOGLE_FONTS_API_KEY}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
branch: font-list-${{ env.TODAY }}
delete-branch: true
title: ${{ env.PULL_REQUEST_TITLE }}