-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tags, createdAt, updatedAt properties (#561)
* 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
1 parent
1d26f95
commit ab50f51
Showing
63 changed files
with
1,240 additions
and
64 deletions.
There are no files selected for viewing
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
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 |
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
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
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
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) |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.