Skip to content

Commit

Permalink
store img urls
Browse files Browse the repository at this point in the history
  • Loading branch information
flickowoa committed Jan 16, 2024
1 parent 28cfc48 commit dae9462
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Update themes.json
run: |
ls
echo "`jq '.themes+=[{"name":"${{ fromJson(steps.parse.outputs.payload).Name }}","repo":"${{ fromJson(steps.parse.outputs.payload).Repo }}","branch":"${{ fromJson(steps.parse.outputs.payload).Branch }}","config":"${{ fromJson(steps.parse.outputs.payload).Config }}","desc":"${{ fromJson(steps.parse.outputs.payload).Description }}"}]' themes.json`" > themes.json
echo "`jq '.themes+=[{"name":"${{ fromJson(steps.parse.outputs.payload).Name }}","repo":"${{ fromJson(steps.parse.outputs.payload).Repo }}","branch":"${{ fromJson(steps.parse.outputs.payload).Branch }}","config":"${{ fromJson(steps.parse.outputs.payload).Config }}","desc":"${{ fromJson(steps.parse.outputs.payload).Description }}","images":[]}]' themes.json`" > themes.json
- name: add submodule
run: |
git submodule add -b '${{ fromJson(steps.parse.outputs.payload).Branch }}' -- '${{ fromJson(steps.parse.outputs.payload).Repo }}' 'themes/${{ fromJson(steps.parse.outputs.payload).Name }}'
Expand Down
7 changes: 0 additions & 7 deletions themes.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{
"themes": [
{
"name": "cyber",
"repo": "https://github.com/taylor85345/cyber-hyprland-theme",
"branch": "master",
"config": "theme.conf",
"desc": "cyber"
},
{
"name": "YoRHa",
"repo": "https://github.com/flick0/dotfiles",
Expand Down
1 change: 0 additions & 1 deletion themes/cyber
Submodule cyber deleted from 82cd55
20 changes: 11 additions & 9 deletions update_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,9 @@ def gen_readme(name,repo,branch,img_files,img_urls):
"""
if img_urls:
if len(img_urls) >= 2:
img_urls = img_urls[:2]
for img in img_urls:
r += f"\n![{name}]({img})\n"
r += f"\n![{name}]({img_urls[0]})\n"
elif img_files:
if len(img_files) >= 2:
img_files = img_files[:2]
for img in img_files:
r += f"\n{repo}/blob/{branch}/{img}?raw=true\n"

r += f"\n{repo}/blob/{branch}/{img_files[0]}?raw=true\n"
return r


Expand Down Expand Up @@ -90,6 +83,8 @@ def find_urls(rdme):
print(images)
return [x[0] for x in images]

with open("./themes.json","r") as f:
themes_json = json.load(f)

for theme in themes:
path = f'themes/{theme["name"].split("/")[-1]}'
Expand All @@ -109,11 +104,18 @@ def find_urls(rdme):
print(urls)

txt = gen_readme(theme["name"],theme["repo"],theme["branch"],image_files,urls)

for t in themes_json["themes"]:
if t["name"] == theme["name"]:
t["images"] = urls

readme += f"\n{txt}\n <hr>\n"

with open("./README.md","w") as f:
f.write(readme)

with open("./themes.json","w") as f:
json.dump(themes_json,f,indent=4)



0 comments on commit dae9462

Please sign in to comment.