Sync Upstream Icons #2
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: Sync Upstream Icons | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout your forked repository | |
- name: Checkout Fork Repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Step 2: Add and fetch upstream remote | |
- name: Add Upstream Remote | |
run: | | |
git remote add upstream https://github.com/tabler/tabler-icons.git | |
git fetch upstream | |
# Step 3: Check for changes in icons/filled and icons/outline | |
- name: Check for Changes | |
id: check_changes | |
run: | | |
git diff --quiet origin/main upstream/main -- icons/filled/ icons/outline/ | |
continue-on-error: true | |
# Step 4: Exit if no changes | |
- name: Exit if No Changes | |
if: ${{ success() }} | |
run: | | |
echo "No changes detected in icons. Exiting." | |
exit 0 | |
# Step 5: Sync icons folder from upstream | |
- name: Sync Icons Folder | |
if: ${{ failure() }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git checkout upstream/main -- icons/filled icons/outline | |
git commit -m "Synced icons folders from upstream" | |
git push origin main | |
# Step 6: Trigger modify-icons.yml workflow | |
- name: Trigger Modify Icons Workflow | |
if: ${{ failure() }} | |
run: | | |
echo "Triggering modify-icons workflow" | |
curl -X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ github.repository }}/actions/workflows/modify-icons.yml/dispatches \ | |
-d '{"ref": "main"}' |