diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml
index 59f05e94..85f21743 100644
--- a/.github/workflows/beta.yml
+++ b/.github/workflows/beta.yml
@@ -105,46 +105,37 @@ jobs:
avatar_url=$(echo "$user_details" | jq -r '.avatar_url')
echo "$name|$login|$avatar_url"
}
+
# Additional information for the goats
declare -A additional_info
additional_info["ibo"]=" Discord: <@951737931159187457>\n AniList: [takarealist112]()\n"
additional_info["aayush262"]=" Discord: <@918825160654598224>\n AniList: [aayush262]()\n"
additional_info["rebelonion"]=" Discord: <@714249925248024617>\n AniList: [rebelonion]()\n PornHub: [rebelonion]()\n"
- # Base commit counts for specific authors
- declare -A base_commit_counts
- base_commit_counts["ibo"]=100
- base_commit_counts["aayush262"]=150
- base_commit_counts["rebelonion"]=200
-
# Extract contributor names from commit log and make unique list
committers=$(echo "$COMMIT_LOG" | sed 's/%0A/\n/g' | grep -oP '(?<=~)[^%]*')
committers=$(echo "$committers" | sort | uniq)
- # Fetch contributors from GitHub
- contributors=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
- "https://api.github.com/repos/rebelonion/Dantotsu/contributors")
- # Initialize an associative array to store manual commit counts
- declare -A manual_commit_counts
-
- # Count commits for each author from the commit messages
+ # Get commit counts on the dev branch
+ commit_counts=$(git shortlog -s -n dev)
+
+ # Prepare commit count JSON
+ json="{"
while IFS= read -r line; do
- author=$(echo "$line" | grep -oP '(?<=~)[^[]*' | xargs)
- if [[ -n "$author" ]]; then
- if [[ -v "manual_commit_counts[$author]" ]]; then
- ((manual_commit_counts[$author]++))
- else
- manual_commit_counts[$author]=1
- fi
- fi
- done <<< "$COMMIT_LOG"
-
+ count=$(echo "$line" | awk '{print $1}')
+ author=$(echo "$line" | cut -d' ' -f2-)
+ json+="\"$author\": $count,"
+ done <<< "$commit_counts"
+ json="${json%,}}"
+
# Initialize needed variables
developers=""
committers_count=0
thumbnail_url="https://i.imgur.com/5o3Y9Jb.gif"
- # Process contributors and filter by committers
- while read -r login api_commits; do
+
+ # Process commit counts
+ for login in $(echo "$json" | jq -r 'keys[]'); do
+ commits=$(echo "$json" | jq -r --arg login "$login" '.[$login]')
user_info=$(fetch_user_details "$login")
name=$(echo "$user_info" | cut -d'|' -f1)
login=$(echo "$user_info" | cut -d'|' -f2)
@@ -154,27 +145,9 @@ jobs:
if [ -n "$extra_info" ]; then
extra_info=$(echo -e "$extra_info" | sed 's/^/- /')
fi
-
- # Use manual count if available, add base count if set, otherwise fallback to API count
- if [[ -v "manual_commit_counts[$name]" ]]; then
- commit_count=${manual_commit_counts[$name]}
- else
- commit_count=0
- fi
-
- # Add base commit count if set
- if [[ -v "base_commit_counts[$name]" ]]; then
- commit_count=$((commit_count + base_commit_counts[$name]))
- fi
-
- # Use API count as fallback if no commits counted
- if [ $commit_count -eq 0 ]; then
- commit_count=$api_commits
- fi
-
developers="${developers}◗ **${name}**
${extra_info} Github: [${login}](https://github.com/${login})
- - Commits: ${commit_count}
+ - Commits: ${commits}
"
committers_count=$((committers_count + 1))
if [ $committers_count -eq 1 ]; then
@@ -183,21 +156,21 @@ jobs:
thumbnail_url="https://i.imgur.com/5o3Y9Jb.gif"
fi
fi
- done < <(echo "$contributors" | jq -r '.[] | "\(.login) \(.contributions)"')
-
+ done
+
# Remove trailing newline
developers=$(echo "$developers" | sed '$ s/$//')
commit_messages=$(echo "$COMMIT_LOG" | sed 's/%0A/\n/g; s/^/\n/')
-
+
# Truncate field values
max_length=1000
if [ ${#developers} -gt $max_length ]; then
developers="${developers:0:$max_length}... (truncated)"
fi
- if [ ${#commit_messages} -gt $max_length ]; then
+ if [ ${#commit_messages} -gt $max_length]; then
commit_messages="${commit_messages:0:$max_length}... (truncated)"
fi
-
+
# Construct Discord payload
discord_data=$(jq -nc \
--arg field_value "$commit_messages" \
@@ -249,7 +222,7 @@ jobs:
# -F "document=@app/build/outputs/apk/google/alpha/app-google-alpha.apk" \
# -F "caption=Alpha-Build: ${VERSION}: ${commit_messages}" \
# https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument
-
+
env:
COMMIT_LOG: ${{ env.COMMIT_LOG }}
VERSION: ${{ env.VERSION }}