Skip to content

Commit 0986998

Browse files
authored
Merge pull request #38 from MattFryer/dev
Implemented script to update js and README when icons are added
2 parents 5a1a892 + 4870815 commit 0986998

File tree

4 files changed

+743
-465
lines changed

4 files changed

+743
-465
lines changed

.github/workflows/update-icons.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Sync Icons
2+
3+
# Runs whenever a push touches the Assets/Icons folder,
4+
# or when the sync script itself is updated.
5+
# Can also be triggered manually from the Actions tab.
6+
on:
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- "Assets/Icons/**"
12+
- "update_icons.py"
13+
workflow_dispatch: # manual trigger
14+
15+
permissions:
16+
contents: write # needed to commit the updated files
17+
18+
jobs:
19+
sync-icons:
20+
name: Sync icon registry and README table
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
# -----------------------------------------------------------------------
25+
# 1. Check out the repository (full depth so we can push back)
26+
# -----------------------------------------------------------------------
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
# -----------------------------------------------------------------------
33+
# 2. Set up Python (stdlib only – no pip dependencies required)
34+
# -----------------------------------------------------------------------
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: "3.11"
39+
40+
# -----------------------------------------------------------------------
41+
# 3. Run the sync script
42+
# -----------------------------------------------------------------------
43+
- name: Run update_icons.py
44+
run: python update_icons.py --repo-root .
45+
46+
# -----------------------------------------------------------------------
47+
# 4. Commit and push if anything changed
48+
# -----------------------------------------------------------------------
49+
- name: Commit changes (if any)
50+
run: |
51+
git config user.name "github-actions[bot]"
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
54+
# Stage only the two managed files
55+
git add Hass-Custom-Icons.js README.md
56+
57+
# Only commit if there are staged changes
58+
if git diff --cached --quiet; then
59+
echo "Nothing to commit – files are already up-to-date."
60+
else
61+
git commit -m "chore: sync icon registry and README [skip ci]"
62+
git push
63+
fi

0 commit comments

Comments
 (0)