Skip to content

Conversation

@dohernandez
Copy link
Member

@dohernandez dohernandez commented Jul 21, 2025

Description

This PR enhances the documentation sync workflow to provide more flexible and robust synchronization between the genlayer-node and documentation repositories. The changes introduce regex pattern filtering for API documentation files, customizable source paths for manual workflow runs, and automatic config.yaml synchronization with sanitization for security.

Motivation and Context

The previous sync workflow had limitations in file filtering and lacked the ability to sync configuration files. This enhancement addresses several needs:

  • Selective syncing of API documentation based on file patterns (separating gen and debug files)
  • Automatic synchronization of config.yaml with security-sensitive information sanitized
  • Flexible path configuration for different repository structures
  • Automated updates to the setup guide when configuration changes

Summary of Changes

Workflow Enhancements

  • Added regex pattern filtering for API gen and debug files (default patterns: gen_(?!dbg_).* and gen_dbg_.*)
  • Added customizable API source paths via workflow_dispatch inputs
  • Implemented config.yaml sync with automatic sanitization:
    • Replaces ZKSync URLs with TODO placeholders
    • Removes sensitive node.dev and node.admin sections using Python YAML parser

New Scripts

  • Created scripts/update-config-in-setup-guide.js to automatically update config content in the validator setup guide
  • Integrated the script into the build process via package.json

Documentation Updates

  • Updated workflow README with comprehensive documentation about:
    • Config sanitization process
    • Regex filtering capabilities
    • New workflow parameters
  • Updated example trigger configuration with new parameters

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Chore (maintenance tasks, refactoring, or non-functional changes)

Testing

The changes have been tested locally by:

  • Running the update-config-in-setup-guide.js script with test config files
  • Verifying regex patterns correctly filter API files
  • Confirming Python-based YAML sanitization properly removes sensitive sections

Checklist:

  • My code follows the code style of this project.
  • I have added the necessary documentation (if appropriate)
  • I have added tests (if appropriate)
  • Lint and unit tests pass locally with my changes

Additional Notes

The Python-based YAML parsing approach was chosen over AWK for reliability across different YAML indentation styles, ensuring robust config sanitization regardless of formatting variations.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced automated syncing and sanitization of a configuration file for validators, now included in the documentation.
    • Added configurable regex-based filtering for API documentation files during synchronization.
    • Enhanced workflow customization with new options for API paths and filtering patterns.
  • Documentation

    • Expanded and clarified workflow documentation, including updated instructions, payload examples, and file structure.
    • Setup guide now automatically updates to reflect the latest example configuration.
  • Chores

    • Added new scripts and updated build processes to support automated config updates in documentation.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The updates introduce regex-based filtering for API documentation file syncing, add a sanitized config file synchronization step, and enhance workflow customization in the GitHub Actions documentation and workflow. Supporting scripts and configuration files are added or updated to automate config block updates in documentation and reflect new workflow behaviors.

Changes

Files/Groups Change Summary
.github/workflows/README.md Expanded documentation for workflow, config sync, regex filters, updated examples, and customization instructions.
.github/workflows/sync-docs-from-node.yml Enhanced workflow: added inputs for path/regex filtering, config sync and sanitization, updated steps for API/doc sync and reporting.
.github/workflows/example-trigger-from-node.yml.example Updated example: changed API doc paths, added regex filter fields for API gen/debug files.
content/validators/config.yaml Added new YAML config file for validator/archive node settings.
package.json Added new script for updating config in setup guide; updated dev/build scripts to invoke it.
scripts/update-config-in-setup-guide.js New script to update YAML config block in setup guide markdown using latest config file.

Sequence Diagram(s)

sequenceDiagram
    participant Workflow as GitHub Actions Workflow
    participant SourceRepo as genlayer-node repo
    participant DocsRepo as docs repo
    participant Script as update-config-in-setup-guide.js

    SourceRepo->>Workflow: Trigger workflow (with paths, regex filters, tag)
    Workflow->>SourceRepo: Clone repo, fetch API files and config.yaml.example
    Workflow->>Workflow: Sanitize config.yaml (remove sections, replace URLs)
    Workflow->>DocsRepo: Sync sanitized config.yaml to content/validators/
    Workflow->>Workflow: Filter API files using regex
    Workflow->>DocsRepo: Sync filtered API files to docs/api/rpc/gen|debug
    Workflow->>Script: Run update-config-in-setup-guide.js
    Script->>DocsRepo: Update YAML block in setup guide
    Workflow->>DocsRepo: Commit and create PR with summary of changes
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • AgustinRamiroDiaz

Poem

In the warren of docs, a rabbit did hop,
Syncing configs and guides with a regex crop.
URLs are now hidden, old blocks replaced—
API files filtered, all neatly traced.
With scripts and yaml, the garden’s in line,
This bunny’s proud: the docs now shine! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e383560 and 9c2633d.

📒 Files selected for processing (6)
  • .github/workflows/README.md (4 hunks)
  • .github/workflows/example-trigger-from-node.yml.example (1 hunks)
  • .github/workflows/sync-docs-from-node.yml (12 hunks)
  • content/validators/config.yaml (1 hunks)
  • package.json (1 hunks)
  • scripts/update-config-in-setup-guide.js (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/nod-189-ci-automate-changelog

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@netlify
Copy link

netlify bot commented Jul 21, 2025

Deploy Preview for genlayer-docs ready!

Name Link
🔨 Latest commit 9c2633d
🔍 Latest deploy log https://app.netlify.com/projects/genlayer-docs/deploys/6883df3e8d0c500008741a32
😎 Deploy Preview https://deploy-preview-251--genlayer-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@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

🧹 Nitpick comments (5)
scripts/update-config-in-setup-guide.js (2)

31-31: Consider making regex patterns more robust.

The current regex patterns work but could be improved for maintainability:

Consider these enhancements for better reliability:

  // Make the primary pattern more flexible with whitespace
- const configPattern = /(You can use the following example configuration[^`]*```yaml\n)([\s\S]*?)(\n```)/;
+ const configPattern = /(You can use the following example configuration[^`]*```yaml\r?\n)([\s\S]*?)(\r?\n```)/;

  // Make fallback pattern more specific to avoid false matches
- const fallbackPattern = /(```yaml\n)([\s\S]*?)(\n```)/;  
+ const fallbackPattern = /(```yaml\r?\n)([\s\S]*?)(\r?\n```)/g;

This handles different line ending formats and makes the fallback pattern more explicit.

Also applies to: 47-47


52-52: Enhance validation logic for better accuracy.

The current validation checks are good but could be more comprehensive:

- if (matches[2].includes('contractmanageraddress') || matches[2].includes('consensus:')) {
+ if (matches[2].includes('contractmanageraddress') || 
+     matches[2].includes('consensus:') || 
+     matches[2].includes('rollup:') ||
+     (matches[2].includes('zksyncurl') && matches[2].includes('node:'))) {

This provides better detection of the validator config block by checking for multiple distinctive fields.

.github/workflows/sync-docs-from-node.yml (3)

620-624: Update PR body – missing the newly-introduced script
The autogenerated PR body omits npm run node-update-config, yet the workflow runs it.
Add it to keep the PR description accurate.

-          - `npm run node-generate-api-docs`
+          - `npm run node-update-config`
+          - `npm run node-generate-api-docs`

445-463: Deletion loop can silently skip unmatched files when DELETED is undefined
You guard with DELETED=${DELETED:-0}, but set -euo pipefail turns unset variables into errors (-u).
Because the parameter expansion occurs before this assignment, the script is still safe, but
readability suffers. Consider initialising DELETED=0 next to ADDED/UPDATED for symmetry.


196-206: Trailing whitespace harms YAML linting
yamllint flags several trailing-space lines, e.g. 196, 199, 202…
These won’t break the workflow, but fixing them silences CI noise.

Also applies to: 246-246, 285-285, 340-340, 402-402, 457-457

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c009a9 and e383560.

📒 Files selected for processing (6)
  • .github/workflows/README.md (4 hunks)
  • .github/workflows/example-trigger-from-node.yml.example (1 hunks)
  • .github/workflows/sync-docs-from-node.yml (12 hunks)
  • content/validators/config.yaml (1 hunks)
  • package.json (1 hunks)
  • scripts/update-config-in-setup-guide.js (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, enhance command documentation in pages/validators/setup-guide.mdx when new features are added to existing commands
content/validators/config.yaml (7)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, update genesis block configuration in the consensus section of pages/validators/setup-guide.mdx when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, update configuration examples with new contract addresses in pages/validators/setup-guide.mdx when applicable

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/changelog.mdx : When updating validator documentation for new releases, add new version entries at the top of pages/validators/changelog.mdx in reverse chronological order and use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, enhance command documentation in pages/validators/setup-guide.mdx when new features are added to existing commands

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : Consensus contract addresses change with network upgrades and must be updated in relevant configuration examples

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : Genesis block numbers are specified for faster node startup and should be updated in configuration examples when necessary

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, update version references in download examples and version lists in pages/validators/setup-guide.mdx

package.json (4)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to scripts/**/*.{js,ts} : Build-time generation scripts are located in the scripts directory

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to scripts/generate-full-docs.js : Full documentation concatenation is performed by scripts/generate-full-docs.js

Learnt from: epsjunior
PR: #244
File: next-env.d.ts:3-6
Timestamp: 2025-07-09T18:27:44.033Z
Learning: Next.js automatically updates next-env.d.ts file during dependency updates, including adding new type references like "next/navigation-types/compat/navigation" when upgrading versions. These changes are not manual edits and should not be flagged as problematic.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, enhance command documentation in pages/validators/setup-guide.mdx when new features are added to existing commands

scripts/update-config-in-setup-guide.js (9)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, update configuration examples with new contract addresses in pages/validators/setup-guide.mdx when applicable

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, update genesis block configuration in the consensus section of pages/validators/setup-guide.mdx when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, enhance command documentation in pages/validators/setup-guide.mdx when new features are added to existing commands

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, update version references in download examples and version lists in pages/validators/setup-guide.mdx

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : Consensus contract addresses change with network upgrades and must be updated in relevant configuration examples

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : Genesis block numbers are specified for faster node startup and should be updated in configuration examples when necessary

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/changelog.mdx : When updating validator documentation for new releases, add new version entries at the top of pages/validators/changelog.mdx in reverse chronological order and use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : GenVM diagnostics integration affects the doctor command behavior and should be documented in the setup-guide.mdx file

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to scripts/generate-full-docs.js : Full documentation concatenation is performed by scripts/generate-full-docs.js

.github/workflows/README.md (6)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, enhance command documentation in pages/validators/setup-guide.mdx when new features are added to existing commands

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, update genesis block configuration in the consensus section of pages/validators/setup-guide.mdx when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, update configuration examples with new contract addresses in pages/validators/setup-guide.mdx when applicable

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to scripts/generate-full-docs.js : Full documentation concatenation is performed by scripts/generate-full-docs.js

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/changelog.mdx : When updating validator documentation for new releases, add new version entries at the top of pages/validators/changelog.mdx in reverse chronological order and use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, update version references in download examples and version lists in pages/validators/setup-guide.mdx

.github/workflows/sync-docs-from-node.yml (2)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to scripts/generate-full-docs.js : Full documentation concatenation is performed by scripts/generate-full-docs.js

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-06-30T14:01:39.620Z
Learning: Applies to pages/validators/setup-guide.mdx : When updating validator documentation for new releases, enhance command documentation in pages/validators/setup-guide.mdx when new features are added to existing commands

🪛 YAMLlint (1.37.1)
content/validators/config.yaml

[error] 64-64: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/sync-docs-from-node.yml

[error] 196-196: trailing spaces

(trailing-spaces)


[error] 199-199: trailing spaces

(trailing-spaces)


[error] 202-202: trailing spaces

(trailing-spaces)


[error] 206-206: trailing spaces

(trailing-spaces)


[error] 210-210: syntax error: could not find expected ':'

(syntax)


[error] 246-246: trailing spaces

(trailing-spaces)


[error] 285-285: trailing spaces

(trailing-spaces)


[error] 340-340: trailing spaces

(trailing-spaces)


[error] 402-402: trailing spaces

(trailing-spaces)


[error] 457-457: trailing spaces

(trailing-spaces)

🪛 actionlint (1.7.7)
.github/workflows/sync-docs-from-node.yml

209-209: could not parse as YAML: yaml: line 209: could not find expected ':'

(syntax-check)

🔇 Additional comments (10)
content/validators/config.yaml (1)

1-64: LGTM! Comprehensive validator configuration with appropriate placeholders.

The configuration file provides a well-structured template for validator nodes with proper sections for rollup, consensus, logging, node operations, and advanced settings. The placeholder URLs and example contract addresses are appropriate for a template that will be sanitized during sync.

.github/workflows/example-trigger-from-node.yml.example (1)

49-52: LGTM! Updated paths and regex filters align with enhanced workflow capabilities.

The changes correctly reflect:

  • Updated API documentation paths to the new /rpc/ structure
  • Added regex filters for selective file syncing:
    • gen_(?!dbg_).* matches general API files excluding debug variants
    • gen_dbg_.* matches only debug API files

This enables fine-grained control over which API documentation files are synchronized.

package.json (1)

6-7: LGTM! Proper integration of config update script into build pipeline.

The new node-update-config script is correctly integrated into both dev and build workflows with logical sequencing:

  1. Generate changelog
  2. Update setup guide versions
  3. Update config in setup guide ← New step
  4. Generate API docs
  5. Generate full docs

This ensures the setup guide's configuration example stays synchronized with the source config file.

Also applies to: 13-13

scripts/update-config-in-setup-guide.js (1)

1-73: LGTM! Well-structured script with good error handling and fallback logic.

The script effectively automates updating the config block in the setup guide with these strengths:

  • Proper file existence validation
  • Primary pattern matching with contextual anchoring
  • Fallback pattern with content verification
  • Standalone execution and module export capabilities
  • Informative logging with timestamps
.github/workflows/README.md (4)

18-30: LGTM! Comprehensive documentation of new config sync and script integration.

The documentation accurately describes:

  • Config file sanitization process (ZKSync URL replacement, section removal)
  • Integration of the new update-config-in-setup-guide.js script
  • Regex filtering capabilities for selective API file syncing

This aligns perfectly with the implementation changes in the other files.


48-52: LGTM! Updated example payload reflects new workflow capabilities.

The example correctly shows:

  • New API documentation paths (docs/api/rpc/gen, docs/api/rpc/debug)
  • Regex filter parameters with appropriate default patterns
  • Proper JSON structure for the repository dispatch payload

81-87: LGTM! Enhanced manual trigger documentation provides clear guidance.

The updated instructions properly document:

  • Required tag parameter for branch naming
  • Optional parameters with sensible defaults
  • Clear parameter descriptions for API paths and regex filters

121-126: LGTM! Clear explanation of regex filtering logic.

The documentation effectively explains:

  • How regex patterns are applied (filename without extension)
  • Default pattern behavior and exclusion logic
  • Distinction between general and debug API files

This will help users understand and customize the filtering behavior.

.github/workflows/sync-docs-from-node.yml (2)

65-81: GitHub-expression fallbacks in a bash run: block are brittle
Inside the run: script the ${{ … }} expressions are rendered before bash executes, so
|| 'default' is evaluated by the GitHub expression engine, not by bash.
That works only when the left operand exists; if the property itself is missing the workflow
fails before reaching the run: step.

Safer pattern:

echo "source_branch=${{ github.event.client_payload.source_branch   || 'main'         }}" >> $GITHUB_OUTPUT

→ OK

echo "api_gen_path=${{ github.event.client_payload.api_gen_path     || 'docs/api/rpc/gen' }}" >> $GITHUB_OUTPUT

For inputs that may truly be null, wrap with github.event.client_payload.api_gen_path != ''
or move the defaulting logic into bash.


502-504: Make sure the new node-update-config npm script exists
The workflow calls npm run node-update-config, but the summary section (lines 620-624) and
package.json snippet in the PR description still list only three node-* scripts.
Double-check that:

  1. package.json actually contains
    "node-update-config": "node scripts/update-config-in-setup-guide.js"
  2. The summary (cat > PR_BODY_FILE) includes this script to avoid confusing reviewers.

Failing to add the script to package.json will exit with npm ERR! missing script.

Implement regex pattern filtering for API gen and debug file synchronization. This allows selective syncing of files based on configurable patterns - gen files use `gen_(?!dbg_).*` to exclude debug files, while debug files use `gen_dbg_.*` pattern. The filtering ensures only relevant files are synced to their respective destinations and properly handles deletions of files that no longer match the patterns.
Add workflow_dispatch inputs for api_gen_path and api_debug_path to allow users to specify custom source paths when manually triggering the sync workflow. This provides flexibility to sync from different directory structures in the source repository. Updated documentation to reflect all available manual trigger parameters.
- Add config.yaml sync step to workflow from config.yaml.example
- Replace ZKSync URLs with TODO placeholders during sync
- Remove node.dev and node.admin sections using Python YAML parser
- Create update-config-in-setup-guide.js script for automatic updates
- Add node-update-config to package.json build process
- Update workflow documentation to explain config sanitization
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.

2 participants