diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..bbe1e515 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,28 @@ +name: Sync to Dune +on: + push: + branches: [main] + +jobs: + update-queries: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Necessary to get a complete history for diff + + - name: Get list of changed files in a specific directory + id: get-changed-files + run: | + CHANGED_FILES=$(git diff \ + --name-only ${{ github.event.before }} ${{ github.sha }} \ + -- queries | paste -sd "," -) + echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV + echo "changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT + + - name: Update Queries + uses: bh2smith/dune-update@v0.1.0 + with: + changedQueries: ${{ steps.get-changed-files.outputs.changed_files }} + duneApiKey: ${{ secrets.DUNE_API_KEY }} diff --git a/README.md b/README.md index 8f29b5c9..f00a6f9f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ -# dune-queries +# Dune Queries + Repository containing protocol relevant dune queries + +All query file names must be formatted as `*_{queryId}.sql`. This will continuous integration to automatically sync queries whenever a PR is merged into main. diff --git a/test_3999763.sql b/test_3999763.sql new file mode 100644 index 00000000..142903c7 --- /dev/null +++ b/test_3999763.sql @@ -0,0 +1,3 @@ +SELECT * +FROM ethereum.transactions +LIMIT 2