Generate Ecosystem Deposit CSVs #4470
This file contains 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
name: Generate Ecosystem Deposit CSVs | |
on: | |
schedule: | |
- cron: "10 * * * *" | |
workflow_dispatch: | |
inputs: | |
POOL_ID: | |
description: "The pool_id of the pool to query, must match a pool in run_pools.json, leave blank for all" | |
BLOCK: | |
description: "The block number to measure at, if unset will use timestamp." | |
TIMESTAMP: | |
description: "A timestamp to take the next block after if BLOCK is undefined, if also undefined will use 5 minutes ago." | |
jobs: | |
generate-csv-files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
ref: action-results | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Generate CSV | |
run: | | |
# If this is a cron job, use the most recent midnight UTC. | |
if [ "$GITHUB_EVENT_NAME" == "schedule" ]; then | |
current_date_utc=$(date -u "+%Y-%m-%d") | |
midnight_utc=$(date -ud "$current_date_utc" +%s) | |
export TIMESTAMP="$midnight_utc" | |
fi | |
cat requirements.txt | |
pip3 install -r requirements.txt | |
pip install gql[requests] | |
python ./generate_ecosystem_deposits.py | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github Action" | |
git add -A | |
git commit -m "Github actions run - time: $TIMESTAMP, block: $BLOCK, pool_id: $POOL_ID" || true | |
git push origin action-results || true |