Skip to content

Update subgraph deploy workflow#97

Open
Siddharth2207 wants to merge 1 commit intomainfrom
2026-03-12-update-deploy-workflow
Open

Update subgraph deploy workflow#97
Siddharth2207 wants to merge 1 commit intomainfrom
2026-03-12-update-deploy-workflow

Conversation

@Siddharth2207
Copy link
Contributor

@Siddharth2207 Siddharth2207 commented Mar 12, 2026

Motivation

  • Update subgraph deploy workflow to deploy to all networks.

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • Chores
    • Restructured deployment workflow with explicit, granular preparation steps including dependency installation and code generation for enhanced clarity
    • Implemented per-network deployment logic with verification checks to prevent redundant deployments across multiple networks
    • Updated authentication approach with token-based login mechanism

@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

Walkthrough

The GitHub Actions workflow for manual subgraph deployment is restructured to replace a single deployment step with multiple granular steps: explicit dependency installation, npm ci, graph code generation, and a per-network deployment loop that checks for existing deployments before building and deploying to each network from networks.json.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/manual-subgraph-deploy.yml
Replaces single deployment command with multi-step process: adds nix-shell and npm ci steps, introduces graph codegen step, replaces environment-based Goldsky login with token flag, and implements per-network deployment loop with existence checks before deployment.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and clearly summarizes the main change: updating the subgraph deploy workflow to support multi-network deployment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2026-03-12-update-deploy-workflow
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.

OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/manual-subgraph-deploy.yml:
- Around line 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.
- Around line 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 01f73f8e-ffa9-486b-ad94-f9abb7de105a

📥 Commits

Reviewing files that changed from the base of the PR and between 4ba9008 and 3d857d1.

📒 Files selected for processing (1)
  • .github/workflows/manual-subgraph-deploy.yml

Comment on lines +31 to +37
- 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
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.

Comment on lines +44 to +52
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
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant