Skip to content

Commit f4a471b

Browse files
committed
Remove app version keys from jsons
1 parent be56bd1 commit f4a471b

8 files changed

Lines changed: 293 additions & 450 deletions

File tree

‎.github/workflows/notify-new-plugin-discord.yml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ jobs:
4949
5050
for entry in new_entries:
5151
url = entry["url"].rstrip("/")
52-
commits = entry.get("commits", {})
53-
if not commits:
52+
sha = entry.get("hash")
53+
if not sha:
5454
continue
55-
sha = list(commits.values())[0]
5655
5756
owner = url.split("/")[-2]
5857
repo_name = url.split("/")[-1]

‎.github/workflows/notify-update-discord.yml‎

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -47,39 +47,26 @@ jobs:
4747
new_data = None
4848
4949
if new_data is not None:
50-
old_dict = {item['url']: item['commits'] for item in old_data if isinstance(item, dict) and 'url' in item and 'commits' in item}
51-
new_dict = {item['url']: item['commits'] for item in new_data if isinstance(item, dict) and 'url' in item and 'commits' in item}
50+
old_dict = {item['url']: item['hash'] for item in old_data if isinstance(item, dict) and 'url' in item and 'hash' in item}
51+
new_dict = {item['url']: item['hash'] for item in new_data if isinstance(item, dict) and 'url' in item and 'hash' in item}
5252
53-
found = False
54-
for url, new_commits in new_dict.items():
55-
if url in old_dict and isinstance(new_commits, dict):
56-
old_commits = old_dict[url]
57-
if not isinstance(old_commits, dict):
58-
continue
59-
60-
# Get the single version key and its new SHA
61-
for version, new_sha in new_commits.items():
62-
old_values = list(old_commits.values())
63-
if not old_values:
64-
continue
65-
# Fallback to absolute positional value if the app version key itself was updated
66-
old_sha = old_commits.get(version) or old_values[0]
67-
68-
# Trigger if the commit hash changed
69-
if old_sha != new_sha:
70-
plugin_name = url.split('/')[-1]
71-
changelog_url = f"{url}/compare/{old_sha}...{new_sha}"
72-
73-
# Creates a clean display string like: "a459c67...bd2cfc3"
74-
display_text = f"{old_sha[:7]}...{new_sha[:7]}"
75-
76-
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
77-
f.write(f"plugin_name={plugin_name}\n")
78-
f.write(f"changelog_url={changelog_url}\n")
79-
f.write(f"display_text={display_text}\n")
80-
found = True
81-
break
82-
if found:
53+
for url, new_sha in new_dict.items():
54+
old_sha = old_dict.get(url)
55+
if not old_sha or not new_sha:
56+
continue
57+
58+
# Trigger if the commit hash changed
59+
if old_sha != new_sha:
60+
plugin_name = url.split('/')[-1]
61+
changelog_url = f"{url}/compare/{old_sha}...{new_sha}"
62+
63+
# Creates a clean display string like: "a459c67...bd2cfc3"
64+
display_text = f"{old_sha[:7]}...{new_sha[:7]}"
65+
66+
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
67+
f.write(f"plugin_name={plugin_name}\n")
68+
f.write(f"changelog_url={changelog_url}\n")
69+
f.write(f"display_text={display_text}\n")
8370
break
8471
8572
- name: Send Message via Discord Bot

‎.github/workflows/update-plugins.yml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ jobs:
2121
REPO_URL: ${{ github.event.client_payload.repo_url }}
2222
COMMIT_SHA: ${{ github.event.client_payload.commit_sha }}
2323
run: |
24-
# Dynamically grabs the first/only key name inside the commits object
25-
# (e.g. "1.5.0-beta") and updates its value to the new commit SHA.
24+
# Sets the entry's hash to the new commit SHA.
2625
jq --arg url "$REPO_URL" --arg sha "$COMMIT_SHA" \
27-
'map(if .url == $url then .commits[(.commits | keys[0])] = $sha else . end)' \
26+
'map(if .url == $url then .hash = $sha else . end)' \
2827
Plugins.json > temp.json && mv temp.json Plugins.json
2928
3029
- name: Extract Plugin Name

‎Icons.json‎

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,26 @@
11
[
22
{
33
"url": "https://github.com/Core447/Material-Icons",
4-
"commits": {
5-
"1.1.1-alpha": "a079fabc31acb66a2b135e28a93c91af9e7cb215",
6-
"1.2.0-alpha": "22038caeae8eeec04f6fe1abb43b4d6304e56375",
7-
"1.4.12-beta": "7b61f21b8fa4b3ff9e978850e60be4f9cbd9b267",
8-
"1.5.1-beta": "61eff8c76f21347f215032800e65f66d536e71d9"
9-
}
4+
"hash": "61eff8c76f21347f215032800e65f66d536e71d9"
105
},
116
{
127
"url": "https://github.com/G4PLS/VolumeIcons",
13-
"commits": {
14-
"1.5.0-beta.2": "d0ae8f6a4fe54ab4914d22ef628d2517babb5a5c"
15-
}
8+
"hash": "d0ae8f6a4fe54ab4914d22ef628d2517babb5a5c"
169
},
1710
{
1811
"url": "https://github.com/axolotlmaid/StreamController-FontAwesome-Icons",
19-
"commits": {
20-
"1.0.0": "732d9249a7c3ea1652c2ced38b40aa204448ba85"
21-
}
12+
"hash": "732d9249a7c3ea1652c2ced38b40aa204448ba85"
2213
},
2314
{
2415
"url": "https://github.com/fishgrind/tabler-streamcontroller-icons",
25-
"commits": {
26-
"1.0.0": "88eff87418a05844e431f91c21b1e68a92c2834c"
27-
}
16+
"hash": "88eff87418a05844e431f91c21b1e68a92c2834c"
2817
},
2918
{
3019
"url": "https://github.com/MyrikLD/streamcontroller_simple_icons",
31-
"commits": {
32-
"1.0.0": "e5a8cade8fc348e48ba97c47207c096d7d39c61e"
33-
}
20+
"hash": "e5a8cade8fc348e48ba97c47207c096d7d39c61e"
3421
},
3522
{
3623
"url": "https://github.com/TaromaruYuki/Bootstrap-Icons-StreamController",
37-
"commits": {
38-
"1.13.1": "9a5b6a1b75a16c23624a63c55f8a632224f57d81"
39-
}
24+
"hash": "9a5b6a1b75a16c23624a63c55f8a632224f57d81"
4025
}
4126
]

0 commit comments

Comments
 (0)