Skip to content

Commit 5946710

Browse files
authored
ci : JSON initialization and add author info
1 parent 539eb1a commit 5946710

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

.github/workflows/convert.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,10 @@ jobs:
122122
HASH_DIR="./Folder-Ico/hash"
123123
SMALL_SVG_DIR="./Folder11/small"
124124
JSON_FILE="./Folder-Ico/Folder11.json"
125-
json_content=$(
126-
jq -n --argjson icons '[]' '
127-
{
128-
"icons": $icons
129-
}
130-
'
131-
)
125+
126+
# Inisialisasi JSON kosong
127+
json_content=$(jq -n '{"icons": []}')
128+
132129
for ico_file in "$ICO_DIR"/*.ico; do
133130
[ -f "$ico_file" ] || continue
134131
filename=$(basename -- "$ico_file")
@@ -138,19 +135,37 @@ jobs:
138135
hash=$(cat "$HASH_DIR/$name.hash")
139136
140137
svg_file_path="svg/$name.svg"
138+
139+
# --- BAGIAN BARU: AMBIL AUTHOR & TANGGAL ---
140+
# Mengambil tanggal commit terakhir
141141
date=$(git -C ./Folder11 log -1 --format=%cd --date=iso-strict -- "$svg_file_path")
142142
143+
# Mengambil nama Author (orang pertama yang membuat file ini)
144+
author=$(git -C ./Folder11 log --diff-filter=A --format="%an" -- "$svg_file_path" | tail -1)
145+
146+
# Jika author kosong (file baru belum di-commit), gunakan default
147+
if [ -z "$author" ]; then author="Unknown"; fi
148+
# -------------------------------------------
149+
143150
small_svg_url=""
144151
if [ -f "$SMALL_SVG_DIR/$name.svg" ]; then
145152
small_svg_url="https://raw.githubusercontent.com/icon11-community/Folder11/main/small/$name.svg"
146153
fi
147154
148155
json_content=$(
149-
echo "$json_content" | jq --arg name "$name" --arg size "$size" --arg url_icon "$url_icon" --arg hash "$hash" --arg date "$date" --arg small_svg_url "$small_svg_url" '
156+
echo "$json_content" | jq \
157+
--arg name "$name" \
158+
--arg size "$size" \
159+
--arg url_icon "$url_icon" \
160+
--arg hash "$hash" \
161+
--arg date "$date" \
162+
--arg author "$author" \
163+
--arg small_svg_url "$small_svg_url" '
150164
.icons += [
151165
{
152166
"name": $name,
153-
"size": $size,
167+
"author": $author,
168+
"size": ($size | tonumber),
154169
"url_icon": $url_icon,
155170
"hash": $hash,
156171
"date": $date,

0 commit comments

Comments
 (0)