Skip to content

Commit

Permalink
TESTING
Browse files Browse the repository at this point in the history
  • Loading branch information
Shebyyy authored Nov 25, 2024
1 parent f9eff29 commit 4fe9ffc
Showing 1 changed file with 54 additions and 53 deletions.
107 changes: 54 additions & 53 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ jobs:
echo "Debug: Processing COMMIT_LOG:"
echo "$COMMIT_LOG"
while read -r count name; do
recent_commit_counts["$name"]=$count
echo "Debug: Commit count for $name: $count"
recent_commit_counts["$name"]=$count
echo "Debug: Commit count for $name: $count"
done < <(echo "$COMMIT_LOG" | sed 's/%0A/\n/g' | grep -oP '(?<=~)[^[]*' | sort | uniq -c | sort -rn)
echo "Debug: Fetching contributors from GitHub"
Expand All @@ -147,13 +147,13 @@ jobs:
echo "$contributors"
sorted_contributors=$(for login in $(echo "$contributors" | jq -r '.[].login'); do
user_info=$(fetch_user_details "$login")
name=$(echo "$user_info" | cut -d'|' -f1)
count=${recent_commit_counts["$name"]:-0}
echo "$count|$login"
user_info=$(fetch_user_details "$login")
name=$(echo "$user_info" | cut -d'|' -f1)
count=${recent_commit_counts["$name"]:-0}
echo "$count|$login"
done | sort -rn | cut -d'|' -f2)
developers=""
developers=""
committers_count=0
max_commits=0
top_contributor=""
Expand All @@ -162,58 +162,58 @@ jobs:
embed_color=$default_color
while read -r login; do
user_info=$(fetch_user_details "$login")
name=$(echo "$user_info" | cut -d'|' -f1)
login=$(echo "$user_info" | cut -d'|' -f2)
avatar_url=$(echo "$user_info" | cut -d'|' -f3)
user_info=$(fetch_user_details "$login")
name=$(echo "$user_info" | cut -d'|' -f1)
login=$(echo "$user_info" | cut -d'|' -f2)
avatar_url=$(echo "$user_info" | cut -d'|' -f3)
commit_count=${recent_commit_counts["$name"]:-0}
if [ $commit_count -gt 0 ]; then
if [ $commit_count -gt $max_commits ]; then
max_commits=$commit_count
top_contributors=("$login")
top_contributor_count=1
top_contributor_avatar="$avatar_url"
embed_color=$(hex_to_decimal "${contributor_colors[$name]:-$default_color}")
elif [ $commit_count -eq $max_commits ]; then
top_contributors+=("$login")
top_contributor_count=$((top_contributor_count + 1))
embed_color=$default_color
fi
echo "Debug top contributors:"
echo "$top_contributors"
commit_count=${recent_commit_counts["$name"]:-0}
if [ $commit_count -gt 0 ]; then
if [ $commit_count -gt $max_commits ]; then
max_commits=$commit_count
top_contributors=("$login")
top_contributor_count=1
top_contributor_avatar="$avatar_url"
embed_color=$(hex_to_decimal "${contributor_colors[$name]:-$default_color}")
elif [ $commit_count -eq $max_commits ]; then
top_contributors+=("$login")
top_contributor_count=$((top_contributor_count + 1))
embed_color=$default_color
fi
echo "Debug top contributors:"
echo "$top_contributors"
branch_commit_count=$(git log --author="$login" --author="$name" --oneline | awk '!seen[$0]++' | wc -l)
branch_commit_count=$(git log --author="$login" --author="$name" --oneline | awk '!seen[$0]++' | wc -l)
echo "Debug: recent_commit_counts contents:"
for key in "${!recent_commit_counts[@]}"; do
echo "$key: ${recent_commit_counts[$key]}"
done
echo "Debug: recent_commit_counts contents:"
for key in "${!recent_commit_counts[@]}"; do
echo "$key: ${recent_commit_counts[$key]}"
done
extra_info="${additional_info[$name]}"
if [ -n "$extra_info" ]; then
extra_info=$(echo "$extra_info" | sed 's/\\n/\n- /g')
fi
extra_info="${additional_info[$name]}"
if [ -n "$extra_info" ]; then
extra_info=$(echo "$extra_info" | sed 's/\\n/\n- /g')
fi
developer_entry="◗ **${name}** ${extra_info}
- Github: [${login}](https://github.com/${login})
- Commits: ${branch_commit_count}"
if [ -n "$developers" ]; then
developers="${developers}
if [ -n "$developers" ]; then
developers="${developers}
${developer_entry}"
else
developers="${developer_entry}"
else
developers="${developer_entry}"
fi
committers_count=$((committers_count + 1))
fi
committers_count=$((committers_count + 1))
fi
done <<< "$sorted_contributors"
if [ $top_contributor_count -eq 1 ]; then
thumbnail_url="$top_contributor_avatar"
thumbnail_url="$top_contributor_avatar"
else
thumbnail_url="https://i.imgur.com/sP4FR70.png"
embed_color=$default_color
thumbnail_url="https://i.imgur.com/5o3Y9Jb.gif"
embed_color=$default_color
fi
max_length=1000
Expand All @@ -231,7 +231,7 @@ jobs:
--arg footer_text "Version $VERSION" \
--arg timestamp "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)" \
--arg thumbnail_url "$thumbnail_url" \
--argjson embed_color "$embed_color" \
--arg embed_color "$embed_color" \
'{
"content": "<@&1208839371575529572>",
"embeds": [
Expand Down Expand Up @@ -261,21 +261,22 @@ jobs:
],
"attachments": []
}')
echo "Debug: Final Discord payload:"
echo "$discord_data"
echo "Debug: Final Discord payload:"
echo "$discord_data"
curl -H "Content-Type: application/json" \
curl -H "Content-Type: application/json" \
-d "$discord_data" \
${{ secrets.DISCORD_WEBHOOK_URL }}
echo "You have only send an embed to discord due to SKIP_BUILD being set to true"
echo "You have only send an embed to discord due to SKIP_BUILD being set to true"
if [ "$SKIP_BUILD" != "true" ]; then
if [ "$SKIP_BUILD" != "true" ]; then
curl -F "payload_json=${contentbody}" \
-F "Awery_debug=@app/build/outputs/apk/alpha/release/Awery_Alpha.apk" \
-F "dantotsu_debug=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" \
${{ secrets.DISCORD_WEBHOOK_URL }}
else
else
echo "Skipping APK upload to Discord due to SKIP_BUILD being set to true"
fi
fi
COMMIT_LOG=$(cat commit_log.txt)
if [ ${#COMMIT_LOG} -gt 1024 ]; then
COMMIT_LOG="${COMMIT_LOG:0:900}"
Expand Down

0 comments on commit 4fe9ffc

Please sign in to comment.