Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions .github/workflows/manual-subgraph-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
Expand All @@ -29,7 +28,26 @@ jobs:
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: nix develop --command subgraph-deploy
env:
GOLDSKY_TOKEN: ${{ secrets.CI_GOLDSKY_TOKEN }}
GOLDSKY_NAME_AND_VERSION: "test-polygon/0.0.1"
- run: nix develop -c rainix-sol-prelude

- run: nix develop -c npm ci
working-directory: subgraph

- run: nix develop -c graph codegen
working-directory: subgraph
Comment on lines +31 to +37
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Gate this workflow on the repo’s canonical subgraph build/test commands.

This path now deploys artifacts built with raw graph codegen/graph build commands and never runs subgraph-test, so the manual deploy workflow can publish a subgraph that has not gone through the repo’s required build/test path. Please switch this workflow to subgraph-build and run subgraph-test before deploy. Based on learnings, Subgraph must be built using nix develop -c subgraph-build and tested using nix develop -c subgraph-test.

Also applies to: 50-51

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/manual-subgraph-deploy.yml around lines 31 - 37, The
workflow currently runs raw graph tool commands (nix develop -c graph codegen /
graph build) which bypass the repo’s canonical subgraph pipeline; replace those
steps so the job uses the repository wrappers: run nix develop -c subgraph-build
(which performs codegen and build) instead of nix develop -c graph codegen/graph
build, and add a step to run nix develop -c subgraph-test before the deploy
step; update the corresponding occurrences (the step invoking "nix develop -c
graph codegen" and the build step around lines referenced, and also the steps at
the other occurrence noted for lines 50-51) to ensure the manual deploy gates on
subgraph-build and subgraph-test.


- run: nix develop -c goldsky login --token ${{ secrets.CI_GOLDSKY_TOKEN }}

- name: Deploy to all networks
working-directory: subgraph
run: |
for NETWORK in $(nix develop -c jq -r 'keys[]' networks.json); do
DEPLOY_NAME="rain-metaboard-${NETWORK}"
if nix develop -c goldsky subgraph list --filter deployments --summary 2>&1 | grep -q "${DEPLOY_NAME}"; then
echo "Skipping ${DEPLOY_NAME} - already deployed"
else
echo "Deploying ${DEPLOY_NAME}..."
nix develop -c graph build --network "${NETWORK}"
nix develop -c goldsky subgraph deploy "${DEPLOY_NAME}/$(date -Idate)"
fi
Comment on lines +44 to +52
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the overlapping network names from the repo data.
jq -r 'keys[]' subgraph/networks.json | sort

# Reproduce the current grep behavior against a plausible Goldsky summary line.
deploy_name="rain-metaboard-base"
simulated_summary=$'rain-metaboard-base-sepolia/2026-03-12'

if printf '%s\n' "$simulated_summary" | grep -q "${deploy_name}"; then
  echo "BUG reproduced: ${deploy_name} is reported as existing when only base-sepolia is present."
else
  echo "No collision reproduced."
fi

Repository: rainlanguage/rain.metadata

Length of output: 207


🏁 Script executed:

sed -n '25,55p' .github/workflows/manual-subgraph-deploy.yml

Repository: rainlanguage/rain.metadata

Length of output: 1259


🏁 Script executed:

# Search for subgraph-build and subgraph-test definitions
rg -i "subgraph-build|subgraph-test" --type json --type sh --type yml

# Also check package.json in subgraph directory
cat subgraph/package.json | grep -A 20 '"scripts"'

Repository: rainlanguage/rain.metadata

Length of output: 596


🏁 Script executed:

# Search for Nix files and check for subgraph-build/subgraph-test definitions
find . -name "flake.nix" -o -name "default.nix" -o -name "shell.nix" | head -20

# Search for these commands in Nix files
rg "subgraph-build|subgraph-test" -g "*.nix"

Repository: rainlanguage/rain.metadata

Length of output: 81


🏁 Script executed:

cat flake.nix

Repository: rainlanguage/rain.metadata

Length of output: 1725


Use an exact deployment lookup here instead of grepping summary text.

Line 46 uses grep -q "${DEPLOY_NAME}" as a substring match against summary output. With the current network set (base and base-sepolia), this creates a collision: rain-metaboard-base will match both rain-metaboard-base and rain-metaboard-base-sepolia deployments, causing the base network to be incorrectly skipped when only base-sepolia is deployed. Additionally, this guard prevents redeploys of any network once any version is deployed, since the substring will always match. Query the exact deployment name instead of grepping summary text.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/manual-subgraph-deploy.yml around lines 44 - 52, The
current deployment existence check uses a substring grep on the summary output
(the "DEPLOY_NAME" variable tested via `goldsky subgraph list --filter
deployments --summary | grep -q "${DEPLOY_NAME}"`), causing collisions like
"rain-metaboard-base" matching "rain-metaboard-base-sepolia"; change this to an
exact lookup by replacing the grep with an exact-match test (e.g., `grep -xF
"${DEPLOY_NAME}"`), or better, call the goldsky CLI with its exact-name
filter/flag if available (use `goldsky subgraph list` with a name filter or
`--name "${DEPLOY_NAME}"`) so the check only returns true for that exact
DEPLOY_NAME.

done
Loading