Skip to content

Commit

Permalink
Added tags, createdAt, updatedAt properties (#561)
Browse files Browse the repository at this point in the history
* add new properties on submit theme

* New GitHub Action for updating `updatedAt`

* change rebuild_themes.py to update tags for color themes

* Adding GitHub Action for updating all theme.json files (temporary)

* Applying corrected themes.json file

* fix: forgot to commit changes

* Update theme.json metadata

* Deleting actions not needed for merge

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
TheRealMG and github-actions[bot] authored Oct 12, 2024
1 parent 1d26f95 commit ab50f51
Show file tree
Hide file tree
Showing 63 changed files with 1,240 additions and 64 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/update-theme-date.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Update Theme Timestamps

on:
pull_request:
types: [closed]
push:
branches:
- main

jobs:
update-timestamp:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Get changes
run: git diff --name-only HEAD^1 HEAD

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Detect changed themes
id: get_changes
run: |
changed_themes=$(git diff --name-only HEAD^1 HEAD | grep '^themes/' | awk -F/ '{print $2}' | sort -u)
echo "CHANGED_THEMES=$changed_themes" >> $GITHUB_ENV
- name: Setup python modules
run: |
pip3 install requests
- name: Setup Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Update theme date
if: env.CHANGED_THEMES != ''
run: |
for theme in $CHANGED_THEMES; do
python3 scripts/update_theme_date.py "themes/$theme"
done
- name: Commit changes
if: env.CHANGED_THEMES != ''
run: |
for theme in $CHANGED_THEMES; do
git add "themes/$theme/theme.json"
done
git commit -m "Update theme.json for $CHANGED_THEMES"
git push
13 changes: 9 additions & 4 deletions scripts/rebuild_themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,16 @@ def main():
theme_colors_output = os.path.join(theme_folder, "chrome.css")
colors = write_colors(theme_colors_file, theme_colors_output)

if "isDarkMode" in colors:
theme_data["isDarkMode"] = colors["isDarkMode"]
if "tags" not in theme_data:
theme_data["tags"] = []

theme_data["isColorTheme"] = True
# Add 'color theme' tag if colors.json is present
theme_data["tags"].append("color theme")

# Add 'dark' tag if colors.json specifies dark mode
if "isDarkMode" in colors and colors["isDarkMode"]:
theme_data["tags"].append("dark")

themes_data[theme] = theme_data

with open(THEMES_DATA_FILE, "w") as f:
Expand Down Expand Up @@ -106,4 +111,4 @@ def main():


if __name__ == "__main__":
main()
main()
6 changes: 5 additions & 1 deletion scripts/submit_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
import argparse
import json
import time
import uuid
import sys
import requests
Expand Down Expand Up @@ -352,6 +353,9 @@ def main():
"image": get_static_asset(theme_id, IMAGE_FILE),
"author": author,
"version": "1.0.0",
"tags": [],
"createdAt": time.strftime("%Y-%m-%d"),
"updatedAt": time.strftime("%Y-%m-%d"),
}

os.makedirs(f"themes/{theme_id}")
Expand Down Expand Up @@ -388,4 +392,4 @@ def main():


if __name__ == "__main__":
main()
main()
41 changes: 41 additions & 0 deletions scripts/update_theme_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import json
import time
import os
import sys


def panic(message: str):
print(message, file=sys.stderr)
exit(1)


def update_theme_date(theme_path):
theme_file = os.path.join(theme_path, "theme.json")

if not os.path.exists(theme_file):
panic(f"{theme_file} not found.")

# Load the theme JSON data
with open(theme_file, "r") as f:
try:
theme_data = json.load(f)
except json.JSONDecodeError as e:
panic("Error reading theme.json: " + str(e))

# Update the `updatedAt` field to the current date
theme_data["updatedAt"] = time.strftime("%Y-%m-%d")

# Write the changes back to theme.json
with open(theme_file, "w") as f:
json.dump(theme_data, f, indent=2)

print(f"Updated `updatedAt` for {theme_path} to {theme_data['updatedAt']}")


if __name__ == "__main__":
# Make sure the script is run with the theme path as an argument
if len(sys.argv) != 2:
panic("Usage: update_theme_date.py <path_to_theme_directory>")

theme_path = sys.argv[1]
update_theme_date(theme_path)
846 changes: 845 additions & 1 deletion themes.json

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion themes/053a3ffa-9233-4554-88f3-076e6a6ebb43/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/053a3ffa-9233-4554-88f3-076e6a6ebb43/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/053a3ffa-9233-4554-88f3-076e6a6ebb43/image.png",
"author": "Tc-001",
"version": "1.0.1"
"version": "1.0.1",
"tags": [
"tabs"
],
"createdAt": "2024-08-21",
"updatedAt": "2024-09-18"
}
5 changes: 4 additions & 1 deletion themes/11d685eb-4515-4045-864b-0a50589f8a4d/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/11d685eb-4515-4045-864b-0a50589f8a4d/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/11d685eb-4515-4045-864b-0a50589f8a4d/image.png",
"author": "antonsizikov",
"version": "1.0.0"
"version": "1.0.0",
"tags": [],
"createdAt": "2024-10-06",
"updatedAt": "2024-10-06"
}
10 changes: 9 additions & 1 deletion themes/17f70712-4530-42d0-ba0f-fa25bcbf2ddc/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/17f70712-4530-42d0-ba0f-fa25bcbf2ddc/readme.md",
"image": "https://i.imgur.com/SmQiVq7.png",
"author": "bdsqqq",
"version": "1.0.1"
"version": "1.0.1",
"isDarkMode": true,
"isColorTheme": true,
"tags": [
"color scheme",
"dark"
],
"createdAt": "2024-08-22",
"updatedAt": "2024-09-03"
}
5 changes: 4 additions & 1 deletion themes/180d9426-a020-4bd7-98ec-63f957291119/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/180d9426-a020-4bd7-98ec-63f957291119/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/180d9426-a020-4bd7-98ec-63f957291119/image.png",
"author": "DaitiDay",
"version": "1.0.0"
"version": "1.0.0",
"tags": [],
"createdAt": "2024-09-18",
"updatedAt": "2024-09-18"
}
5 changes: 4 additions & 1 deletion themes/1e86cf37-a127-4f24-b919-d265b5ce29a0/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/1e86cf37-a127-4f24-b919-d265b5ce29a0/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/1e86cf37-a127-4f24-b919-d265b5ce29a0/image.png",
"author": "KiKaraage",
"version": "1.0.0"
"version": "1.0.0",
"tags": [],
"createdAt": "2024-09-03",
"updatedAt": "2024-09-03"
}
5 changes: 4 additions & 1 deletion themes/1e9f3101-210b-4ff5-8830-434e4919100d/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/1e9f3101-210b-4ff5-8830-434e4919100d/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/1e9f3101-210b-4ff5-8830-434e4919100d/image.png",
"author": "qtchaos",
"version": "1.0.0"
"version": "1.0.0",
"tags": [],
"createdAt": "2024-08-28",
"updatedAt": "2024-08-28"
}
7 changes: 6 additions & 1 deletion themes/2e3369c7-e450-46ba-8794-75ccb0de5e48/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/2e3369c7-e450-46ba-8794-75ccb0de5e48/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/2e3369c7-e450-46ba-8794-75ccb0de5e48/image.png",
"author": "benstone326",
"version": "1.2.1"
"version": "1.2.1",
"tags": [
"tabs"
],
"createdAt": "2024-08-28",
"updatedAt": "2024-10-03"
}
7 changes: 6 additions & 1 deletion themes/35f24f2c-b211-43e2-9fe4-2c3bc217d9f7/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/35f24f2c-b211-43e2-9fe4-2c3bc217d9f7/image.png",
"author": "Tc-001",
"version": "1.0.0",
"preferences": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/35f24f2c-b211-43e2-9fe4-2c3bc217d9f7/preferences.json"
"preferences": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/35f24f2c-b211-43e2-9fe4-2c3bc217d9f7/preferences.json",
"tags": [
"tabs"
],
"createdAt": "2024-08-28",
"updatedAt": "2024-09-07"
}
5 changes: 4 additions & 1 deletion themes/39907934-59e9-4e42-89f0-a254d3c5e280/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/39907934-59e9-4e42-89f0-a254d3c5e280/image.png",
"author": "shanto",
"version": "1.0.0",
"preferences": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/39907934-59e9-4e42-89f0-a254d3c5e280/preferences.json"
"preferences": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/39907934-59e9-4e42-89f0-a254d3c5e280/preferences.json",
"tags": [],
"createdAt": "2024-10-09",
"updatedAt": "2024-10-09"
}
7 changes: 6 additions & 1 deletion themes/3ff55ba7-4690-4f74-96a8-9e4416685e4e/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/3ff55ba7-4690-4f74-96a8-9e4416685e4e/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/3ff55ba7-4690-4f74-96a8-9e4416685e4e/image.png",
"author": "ocean-mars",
"version": "1.0.0"
"version": "1.0.0",
"tags": [
"tabs"
],
"createdAt": "2024-10-06",
"updatedAt": "2024-10-06"
}
5 changes: 4 additions & 1 deletion themes/46690a54-5eff-4141-8af8-9cd772ab6e2c/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/46690a54-5eff-4141-8af8-9cd772ab6e2c/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/46690a54-5eff-4141-8af8-9cd772ab6e2c/image.png",
"author": "Hypatech",
"version": "1.0.0"
"version": "1.0.0",
"tags": [],
"createdAt": "2024-09-25",
"updatedAt": "2024-09-25"
}
7 changes: 6 additions & 1 deletion themes/49dbaa98-06ee-42bd-9a8e-834babef7a41/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/49dbaa98-06ee-42bd-9a8e-834babef7a41/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/49dbaa98-06ee-42bd-9a8e-834babef7a41/image.png",
"author": "burnt0rice",
"version": "1.0.0"
"version": "1.0.0",
"tags": [
"tabs"
],
"createdAt": "2024-08-31",
"updatedAt": "2024-09-07"
}
5 changes: 4 additions & 1 deletion themes/4ab93b88-151c-451b-a1b7-a1e0e28fa7f8/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/4ab93b88-151c-451b-a1b7-a1e0e28fa7f8/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/4ab93b88-151c-451b-a1b7-a1e0e28fa7f8/image.png",
"author": "mally8",
"version": "1.0.1"
"version": "1.0.1",
"tags": [],
"createdAt": "2024-09-01",
"updatedAt": "2024-09-07"
}
5 changes: 4 additions & 1 deletion themes/4ce2b68c-84f1-4296-b145-4e590ad7a19e/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/4ce2b68c-84f1-4296-b145-4e590ad7a19e/image.png",
"author": "anaarkei",
"version": "1.1.1",
"preferences": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/4ce2b68c-84f1-4296-b145-4e590ad7a19e/preferences.json"
"preferences": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/4ce2b68c-84f1-4296-b145-4e590ad7a19e/preferences.json",
"tags": [],
"createdAt": "2024-09-24",
"updatedAt": "2024-09-30"
}
10 changes: 9 additions & 1 deletion themes/56449583-f295-4f34-baf8-da70d3d156e7/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/56449583-f295-4f34-baf8-da70d3d156e7/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/56449583-f295-4f34-baf8-da70d3d156e7/image.png",
"author": "mohvn",
"version": "1.0.0"
"version": "1.0.0",
"isDarkMode": true,
"isColorTheme": true,
"tags": [
"color scheme",
"dark"
],
"createdAt": "2024-09-09",
"updatedAt": "2024-09-09"
}
5 changes: 4 additions & 1 deletion themes/570afd9d-96fa-48b5-bad3-0c106757cce9/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/570afd9d-96fa-48b5-bad3-0c106757cce9/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/570afd9d-96fa-48b5-bad3-0c106757cce9/image.png",
"author": "lingais",
"version": "1.0.0"
"version": "1.0.0",
"tags": [],
"createdAt": "2024-08-28",
"updatedAt": "2024-08-28"
}
5 changes: 4 additions & 1 deletion themes/58649066-2b6f-4a5b-af6d-c3d21d16fc00/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/58649066-2b6f-4a5b-af6d-c3d21d16fc00/image.png",
"author": "danm36",
"preferences": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/58649066-2b6f-4a5b-af6d-c3d21d16fc00/preferences.json",
"version": "1.0.4"
"version": "1.0.4",
"tags": [],
"createdAt": "2024-08-09",
"updatedAt": "2024-09-25"
}
5 changes: 4 additions & 1 deletion themes/5941aefd-67b0-453d-9b62-9071a31cbb0d/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/5941aefd-67b0-453d-9b62-9071a31cbb0d/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/5941aefd-67b0-453d-9b62-9071a31cbb0d/image.png",
"author": "n7itro",
"version": "1.0.2"
"version": "1.0.2",
"tags": [],
"createdAt": "2024-08-31",
"updatedAt": "2024-10-01"
}
5 changes: 4 additions & 1 deletion themes/5a007026-0801-4a5d-9740-f17dc1c3ff21/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/5a007026-0801-4a5d-9740-f17dc1c3ff21/image.png",
"author": "n7itro",
"preferences": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/5a007026-0801-4a5d-9740-f17dc1c3ff21/preferences.json",
"version": "1.0.0"
"version": "1.0.0",
"tags": [],
"createdAt": "2024-08-16",
"updatedAt": "2024-08-22"
}
5 changes: 4 additions & 1 deletion themes/5ac61d13-a0dc-400e-aaa0-0f10fd3a7d0c/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/5ac61d13-a0dc-400e-aaa0-0f10fd3a7d0c/readme.md",
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/5ac61d13-a0dc-400e-aaa0-0f10fd3a7d0c/image.png",
"author": "andrewbellucci",
"version": "1.0.0"
"version": "1.0.0",
"tags": [],
"createdAt": "2024-08-24",
"updatedAt": "2024-08-24"
}
Loading

0 comments on commit ab50f51

Please sign in to comment.