Skip to content

Add workflow to update vote totals for plomin action #2

Add workflow to update vote totals for plomin action

Add workflow to update vote totals for plomin action #2

name: Update Vote Totals
on:
pull_request:
branches:
- main
jobs:
update-vote-totals:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Query API for vote totals
id: query_api
run: |
response=$(curl -s -X GET "https://api.koios.rest/api/v1/proposal_voting_summary?_proposal_id=gov_action1pvv5wmjqhwa4u85vu9f4ydmzu2mgt8n7et967ph2urhx53r70xusqnmm525")
echo "$response" > vote_totals.json
- name: Update markdown file
id: update_markdown
run: |
response=$(cat vote_totals.json)
yes=$(echo "$response" | jq -r '.[0].pool_yes_votes_cast')
no=$(echo "$response" | jq -r '.[0].pool_no_votes_cast')
abstain=$(echo "$response" | jq -r '.[0].pool_abstain_votes_cast')
yes_stake=$(echo "$response" | jq -r '.[0].pool_active_yes_vote_power')
no_stake=$(echo "$response" | jq -r '.[0].pool_active_not_vote_power')
abstain_stake=$(echo "$response" | jq -r '.[0].pool_active_abstain_vote_power')
echo "Yes votes: $yes"
echo "No votes: $no"
echo "Abstain votes: $abstain"
echo "Yes stake: $yes_stake"
echo "No stake: $no_stake"
echo "Abstain stake: $abstain_stake"