Skip to content

Commit

Permalink
Merge pull request #1169 from BalancerMaxis/issue/1120
Browse files Browse the repository at this point in the history
feat: query upkeeps from dune
  • Loading branch information
gosuto-inzasheru authored Jul 17, 2024
2 parents 4f1b23b + e1d5527 commit cd96e7d
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/upkeeps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Query all Chainlink upkeeps

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
query_upkeeps:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.10
cache: "pip"

- name: Query Dune
env:
DUNE_API_KEY: ${{ secrets.DUNE_API_KEY }}
run: |
pwd
RUN_DIR=tools/python
pip install -r $RUN_DIR/requirements.txt
python $RUN_DIR/query_upkeeps.py
- name: Commit and push reports
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "ci: dump csv file with all queried upkeeps"
31 changes: 31 additions & 0 deletions tools/python/query_upkeeps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import pandas as pd
from dune_client.client import DuneClient
from dune_client.types import QueryParameter
from dune_client.query import QueryBase


def get_upkeeps(chain="ethereum"):
dune = DuneClient.from_env()
query = QueryBase(
name="@gosuto/cla_chain_upkeeps",
query_id=3889683,
params=[
QueryParameter.enum_type(name="chain", value=chain),
],
)
return dune.run_query_dataframe(query)


if __name__ == "__main__":
dfs = []
for chain in [
"ethereum",
"arbitrum",
"polygon",
"optimism",
"avalanche",
"base",
"gnosis",
]:
dfs.append(get_upkeeps(chain))
pd.concat(dfs).to_csv("../../out/upkeeps.csv", index=False)

0 comments on commit cd96e7d

Please sign in to comment.