Created
April 17, 2023 23:55
-
-
Save jwiegley/234dd01af00ccbce42d899325da51369 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
URL='https://ic-api.internetcomputer.org/api/v3/proposals?include_action=ExecuteNnsFunction&offset=0&include_topic=TOPIC_REPLICA_VERSION_MANAGEMENT&limit=50&include_status=OPEN&include_reward_status=ACCEPT_VOTES' | |
if [[ ! -f proposals_seen ]]; then | |
touch proposals_seen | |
fi | |
echo "Checking for new proposals at $(date)" | |
for proposal in $(curl -sX GET "$URL" -H 'accept: application/json' | jq -r '.data[].proposal_id') | |
do | |
if ! grep -q "^$proposal\$" proposals_seen | |
then | |
echo $proposal >> proposals_seen | |
cat > message.txt <<EOF | |
From: [email protected] | |
To: [email protected] | |
Subject: Replica Upgrade Proposal: $proposal | |
There is a new replica upgrade proposal available: | |
https://dashboard.internetcomputer.org/proposal/$proposal | |
EOF | |
cat message.txt | msmtp -C ./msmtp.config --read-envelope-from --read-recipients | |
fi | |
done | |
URL='https://ic-api.internetcomputer.org/api/v3/proposals?include_action=ExecuteNnsFunction&offset=0&include_topic=TOPIC_GOVERNANCE&include_topic=TOPIC_SNS_AND_COMMUNITY_FUND&limit=50&include_status=OPEN&include_reward_status=ACCEPT_VOTES' | |
if [[ ! -f governance_seen ]]; then | |
touch governance_seen | |
fi | |
echo "Checking for new governance proposals at $(date)" | |
for proposal in $(curl -sX GET "$URL" -H 'accept: application/json' | jq -r '.data[].proposal_id') | |
do | |
if ! grep -q "^$proposal\$" governance_seen | |
then | |
echo $proposal >> governance_seen | |
cat > message.txt <<EOF | |
From: [email protected] | |
To: [email protected] | |
Subject: Governance or SNS/SF Proposal: $proposal | |
There is a new governance or SNS/SF proposal available: | |
https://dashboard.internetcomputer.org/proposal/$proposal | |
EOF | |
cat message.txt | msmtp -C ./msmtp.config --read-envelope-from --read-recipients | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment