mirror of
https://github.com/zen-browser/theme-store.git
synced 2025-07-07 08:55:31 +02:00
Fix Theme Metadata Duplication and Add Missing Properties for Recent Pull Requests (#575)
* fix ability to add tags multiple times when rebuilding themes * fix `createdAt` not being added for pull requests made prior * adds tags property if it doesn't exist (old PRs) * updated affected `theme.json` files * updated more affected `theme.json` files * fix action failing if new commits before finished * make action only initiate when themes are changed
This commit is contained in:
parent
65c8c1fed0
commit
a73edd785e
13 changed files with 53 additions and 14 deletions
9
.github/workflows/update-theme-date.yml
vendored
9
.github/workflows/update-theme-date.yml
vendored
|
@ -1,13 +1,11 @@
|
|||
name: Update Theme Timestamps
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types: [closed]
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'themes/**'
|
||||
|
||||
jobs:
|
||||
update-timestamp:
|
||||
|
@ -57,4 +55,5 @@ jobs:
|
|||
git add "themes/$theme/theme.json"
|
||||
done
|
||||
git commit -m "Update \`updated at\` field for \`$CHANGED_THEMES\`"
|
||||
git push
|
||||
git pull origin main --strategy-option=theirs
|
||||
git push origin main
|
||||
|
|
|
@ -75,11 +75,12 @@ def main():
|
|||
if "tags" not in theme_data:
|
||||
theme_data["tags"] = []
|
||||
|
||||
# Add 'color theme' tag if colors.json is present
|
||||
theme_data["tags"].append("color theme")
|
||||
# Add 'color theme' tag if colors.json is present and tag isn't already in tags list
|
||||
if "color scheme" not in theme_data["tags"]:
|
||||
theme_data["tags"].append("color scheme")
|
||||
|
||||
# Add 'dark' tag if colors.json specifies dark mode
|
||||
if "isDarkMode" in colors and colors["isDarkMode"]:
|
||||
# Add 'dark' tag if colors.json specifies dark mode and tag isn't already in tags list
|
||||
if "isDarkMode" in colors and colors["isDarkMode"] and "dark" not in theme_data["tags"]:
|
||||
theme_data["tags"].append("dark")
|
||||
|
||||
themes_data[theme] = theme_data
|
||||
|
|
|
@ -21,9 +21,23 @@ def update_theme_date(theme_path):
|
|||
theme_data = json.load(f)
|
||||
except json.JSONDecodeError as e:
|
||||
panic("Error reading theme.json: " + str(e))
|
||||
|
||||
# Get the current date
|
||||
current_date = time.strftime("%Y-%m-%d")
|
||||
|
||||
# Set `createdAt` to the current date if it doesn't exist
|
||||
if "createdAt" not in theme_data:
|
||||
theme_data["createdAt"] = current_date
|
||||
print(f"Set `createdAt` for {theme_path} to {theme_data['createdAt']}")
|
||||
|
||||
# Update the `updatedAt` field to the current date
|
||||
theme_data["updatedAt"] = time.strftime("%Y-%m-%d")
|
||||
theme_data["updatedAt"] = current_date
|
||||
print(f"Updated `updatedAt` for {theme_path} to {theme_data['updatedAt']}")
|
||||
|
||||
# Add `tags` as an empty list if it doesn't exist
|
||||
if "tags" not in theme_data:
|
||||
theme_data["tags"] = []
|
||||
print(f"Initialized `tags` for {theme_path} as an empty list")
|
||||
|
||||
# Write the changes back to theme.json
|
||||
with open(theme_file, "w") as f:
|
||||
|
|
|
@ -7,5 +7,7 @@
|
|||
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/253a3a74-0cc4-47b7-8b82-996a64f030d5/readme.md",
|
||||
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/253a3a74-0cc4-47b7-8b82-996a64f030d5/image.png",
|
||||
"author": "ahmaadaziz",
|
||||
"createdAt": "2024-10-12",
|
||||
"updatedAt": "2024-10-12",
|
||||
"version": "1.0.0"
|
||||
}
|
|
@ -8,5 +8,7 @@
|
|||
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/4596d8f9-f0b7-4aeb-aa92-851222dc1888/image.png",
|
||||
"author": "p-sw",
|
||||
"version": "1.0.0",
|
||||
"tags": [],
|
||||
"createdAt": "2024-10-12",
|
||||
"updatedAt": "2024-10-12"
|
||||
}
|
|
@ -10,5 +10,5 @@
|
|||
"version": "1.0.2",
|
||||
"tags": [],
|
||||
"createdAt": "2024-09-01",
|
||||
"updatedAt": "2024-09-07"
|
||||
"updatedAt": "2024-10-12"
|
||||
}
|
|
@ -8,5 +8,7 @@
|
|||
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/5c4d7772-d963-4672-ab03-e9d541438881/image.png",
|
||||
"author": "jvabn",
|
||||
"version": "1.0.0",
|
||||
"tags": [],
|
||||
"createdAt": "2024-10-12",
|
||||
"updatedAt": "2024-10-12"
|
||||
}
|
|
@ -15,5 +15,5 @@
|
|||
"dark"
|
||||
],
|
||||
"createdAt": "2024-08-31",
|
||||
"updatedAt": ""
|
||||
"updatedAt": "2024-08-31"
|
||||
}
|
|
@ -9,5 +9,7 @@
|
|||
"author": "TheRealMG",
|
||||
"version": "1.0.0",
|
||||
"preferences": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/664c54f9-d97d-410b-a479-23dd8a08a628/preferences.json",
|
||||
"tags": [],
|
||||
"createdAt": "2024-10-12",
|
||||
"updatedAt": "2024-10-12"
|
||||
}
|
|
@ -10,5 +10,5 @@
|
|||
"version": "1.0.2",
|
||||
"tags": [],
|
||||
"createdAt": "2024-09-24",
|
||||
"updatedAt": "2024-09-25"
|
||||
"updatedAt": "2024-10-12"
|
||||
}
|
|
@ -8,5 +8,7 @@
|
|||
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/7ba20fe1-7286-4b1f-9bf6-39d40bec8ae0/image.png",
|
||||
"author": "shaeriz",
|
||||
"version": "1.0.0",
|
||||
"tags": [],
|
||||
"createdAt": "2024-10-12",
|
||||
"updatedAt": "2024-10-12"
|
||||
}
|
|
@ -8,5 +8,7 @@
|
|||
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/bb61b145-6875-4afe-86f2-ab00024459dc/image.png",
|
||||
"author": "mehalter",
|
||||
"version": "1.0.0",
|
||||
"tags": [],
|
||||
"createdAt": "2024-10-12",
|
||||
"updatedAt": "2024-10-12"
|
||||
}
|
|
@ -1 +1,14 @@
|
|||
{"id": "f7c71d9a-bce2-420f-ae44-a64bd92975ab", "name": "Better Unloaded Tabs", "description": "Makes unloaded tabs easier to notice by making them greyscale and transparent.", "homepage": "https://github.com/Felkazz/zen-browser-better-unloaded-tabs", "style": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/f7c71d9a-bce2-420f-ae44-a64bd92975ab/chrome.css", "readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/f7c71d9a-bce2-420f-ae44-a64bd92975ab/readme.md", "image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/f7c71d9a-bce2-420f-ae44-a64bd92975ab/image.png", "author": "Felkazz", "version": "1.0.1", "updatedAt": "2024-10-12"}
|
||||
{
|
||||
"id": "f7c71d9a-bce2-420f-ae44-a64bd92975ab",
|
||||
"name": "Better Unloaded Tabs",
|
||||
"description": "Makes unloaded tabs easier to notice by making them greyscale and transparent.",
|
||||
"homepage": "https://github.com/Felkazz/zen-browser-better-unloaded-tabs",
|
||||
"style": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/f7c71d9a-bce2-420f-ae44-a64bd92975ab/chrome.css",
|
||||
"readme": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/f7c71d9a-bce2-420f-ae44-a64bd92975ab/readme.md",
|
||||
"image": "https://raw.githubusercontent.com/zen-browser/theme-store/main/themes/f7c71d9a-bce2-420f-ae44-a64bd92975ab/image.png",
|
||||
"author": "Felkazz",
|
||||
"version": "1.0.1",
|
||||
"tags": [],
|
||||
"createdAt": "2024-10-12",
|
||||
"updatedAt": "2024-10-12"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue