Skip to content

Commit

Permalink
try fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryun1 committed Jan 10, 2025
1 parent c4798d8 commit 63c914f
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/update-plomin-votes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,31 @@ jobs:
run: |
response=$(cat vote_totals.json)
# Get vote totals for ICC
cc_yes=$(echo "$response" | jq -r '.[0].committee_yes_votes_cast')
cc_no=$(echo "$response" | jq -r '.[0].committee_no_votes_cast')
cc_abstain=$(echo "$response" | jq -r '.[0].committee_abstain_votes_cast')
cc_not_voted=$((7 - cc_yes - cc_no - cc_abstain))
# Get vote percentages for ICC
cc_yes_pct=$(echo "$response" | jq -r '.[0].committee_yes_pct')
cc_no_pct=$(echo "$response" | jq -r '.[0].committee_no_pct')
cc_abstain_pct=$(echo "scale=2; 100 / 7 * $cc_abstain" | bc)
cc_not_voted_pct=$(echo "scale=2; 100 - $cc_yes_pct - $cc_no_pct - $cc_abstain_pct" | bc)
# Get vote totals for SPO
spo_yes=$(echo "$response" | jq -r '.[0].pool_yes_votes_cast')
spo_no=$(echo "$response" | jq -r '.[0].pool_no_votes_cast')
spo_abstain=$(echo "$response" | jq -r '.[0].pool_abstain_votes_cast')
spo_not_voted=$((2787 - spo_yes - spo_no - spo_abstain))
# Get stake totals for SPO
spo_yes_stake=$(echo "$response" | jq -r '.[0].pool_active_yes_vote_power')
spo_no_stake=$(echo "$response" | jq -r '.[0].pool_active_no_vote_power')
spo_abstain_stake=$(echo "$response" | jq -r '.[0].pool_active_abstain_vote_power')
spo_total_stake=21800000000000000
spo_not_voted_stake=$((spo_total_stake - spo_yes_stake - spo_no_stake - spo_abstain_stake))
spo_not_voted_stake=$((21800000000000000 - spo_yes_stake - spo_no_stake - spo_abstain_stake))
# Get vote percentages for SPO
spo_yes_pct=$(echo "$response" | jq -r '.[0].pool_yes_pct')
spo_no_not_pct=$(echo "$response" | jq -r '.[0].pool_no_pct')
Expand Down Expand Up @@ -86,18 +90,18 @@ jobs:
echo "spo_yes_pct=$spo_yes_pct" >> $GITHUB_ENV
echo "spo_no_not_pct=$spo_no_not_pct" >> $GITHUB_ENV
echo "spo_yes=$spo_yes"
echo "spo_no=$spo_no"
echo "spo_abstain=$spo_abstain"
echo "spo_not_voted=$spo_not_voted"
# echo "spo_yes=$spo_yes"
# echo "spo_no=$spo_no"
# echo "spo_abstain=$spo_abstain"
# echo "spo_not_voted=$spo_not_voted"
echo "spo_yes_stake_formatted=$spo_yes_stake_formatted"
echo "spo_no_stake_formatted=$spo_no_stake_formatted"
echo "spo_abstain_stake_formatted=$spo_abstain_stake_formatted"
echo "spo_not_voted_stake_formatted=$spo_not_voted_stake_formatted"
# echo "spo_yes_stake_formatted=$spo_yes_stake_formatted"
# echo "spo_no_stake_formatted=$spo_no_stake_formatted"
# echo "spo_abstain_stake_formatted=$spo_abstain_stake_formatted"
# echo "spo_not_voted_stake_formatted=$spo_not_voted_stake_formatted"
echo "spo_yes_pct=$spo_yes_pct"
echo "spo_no_not_pct=$spo_no_not_pct"
# echo "spo_yes_pct=$spo_yes_pct"
# echo "spo_no_not_pct=$spo_no_not_pct"
- name: Update page
run: |
Expand Down Expand Up @@ -128,8 +132,8 @@ jobs:
sed -i "s/| No + Not Voted |.*|/| No + Not Voted | $spo_no_not_pct% |/" ./gitbook/plomin-upgrade/chang-upgrade-2-readiness/README.md
sed -i "s/SPO vote summary last updated: .*/SPO vote summary last updated: $current_datetime/" ./gitbook/plomin-upgrade/chang-upgrade-2-readiness/README.md
sed -i "s/| Yes |.*|/| Yes | $spo_yes | $spo_yes_stake_formatted |/" ./gitbook/plomin-upgrade/chang-upgrade-2-readiness/README.md
sed -i "s/| No |.*|/| No | $spo_no | $spo_no_stake_formatted |/" ./gitbook/plomin-upgrade/chang-upgrade-2-readiness/README.md
sed -i "s/| Yes |.*|/| Yes | $spo_yes | $spo_yes_stake_formatted |/" ./gitbook/plomin-upgrade/chang-upgrade-2-readiness/README.md
sed -i "s/| No |.*|/| No | $spo_no | $spo_no_stake_formatted |/" ./gitbook/plomin-upgrade/chang-upgrade-2-readiness/README.md
sed -i "s/| Abstain |.*|/| Abstain | $spo_abstain | $spo_abstain_stake_formatted |/" ./gitbook/plomin-upgrade/chang-upgrade-2-readiness/README.md
sed -i "s/| Not Voted |.*|/| Not Voted | $spo_not_voted | $spo_not_voted_stake_formatted |/" ./gitbook/plomin-upgrade/chang-upgrade-2-readiness/README.md
sed -i "s/SPO vote total last updated: .*/SPO vote total last updated: $current_datetime/" ./gitbook/plomin-upgrade/chang-upgrade-2-readiness/README.md
Expand Down

0 comments on commit 63c914f

Please sign in to comment.