Skip to content

Conversation

@dohernandez
Copy link
Member

@dohernandez dohernandez commented Jul 25, 2025

chore(workflows): Simplify sync-docs-from-node workflow

Description

This PR simplifies the sync-docs-from-node workflow by consolidating the source_branch and tag parameters into a single version parameter. The workflow now uses the version/tag directly to checkout the correct release from the genlayer-node repository, eliminating confusion and ensuring documentation always matches the exact version being documented.

Summary by CodeRabbit

  • Chores
    • Simplified workflow inputs by consolidating branch and tag into a single optional version parameter.
    • Improved branch creation and git push safety during documentation sync.
    • Enhanced regex matching in workflows with PCRE support for better file filtering.
    • Updated workflow naming conventions and outputs from "tag" to "version" for clarity.
    • Unified API documentation paths across workflows and docs.
    • Improved logging and debug output for configuration sanitization and sync steps.
    • Refined configuration sanitization to remove sensitive sections using regex-based text processing.
    • No changes to core workflow logic or functionality.

@netlify
Copy link

netlify bot commented Jul 25, 2025

Deploy Preview for genlayer-docs ready!

Name Link
🔨 Latest commit 1e91472
🔍 Latest deploy log https://app.netlify.com/projects/genlayer-docs/deploys/6884d641dfa70e000828d74b
😎 Deploy Preview https://deploy-preview-257--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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 25, 2025

Walkthrough

This update refactors two GitHub Actions workflow files to consolidate and standardize versioning parameters. The sync-docs-from-node.yml workflow now uses a single optional version input instead of separate source_branch and tag inputs, with all internal references updated accordingly, including branch handling and regex matching improvements. The example trigger workflow aligns its variable names and outputs to match this change. Additionally, API documentation paths were unified in the workflow README. The config sanitization script was enhanced with detailed debug output and refactored to use regex-based plain text processing instead of YAML parsing.

Changes

File(s) Change Summary
.github/workflows/sync-docs-from-node.yml Replaced source_branch and tag inputs with a single optional version input defaulting to "latest"; updated all references to use version; added detection of latest semantic version tag when version is "latest"; improved branch existence check and safe git push with --force-with-lease; enhanced regex matching by introducing a matches_pattern shell function supporting PCRE via perl fallback to grep -E; improved logging format and clarity; sanitized branch names; added extensive debug output for config sync and doc generation steps.
.github/workflows/example-trigger-from-node.yml.example Renamed step and variable from get_tag/LATEST_TAG to get_version/VERSION; updated output key and all references from tag to version; changed API gen and debug paths to a unified docs/api/rpc. No logic changes.
.github/workflows/README.md Updated documentation to reflect unified API gen and debug paths to docs/api/rpc in example payloads and descriptions.
.github/scripts/sanitize-config.py Refactored sanitize_config to remove YAML parsing and instead use regex-based plain text processing to remove node.admin and node.dev sections; added detailed debug print statements showing file size before and after sanitization and confirming section removals; preserved function signature and core logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Poem

A rabbit hopped through YAML fields,
Merging tags and branches yields—
One "version" now, so clear and bright,
Workflows streamlined, just right!
With paws on keys, I cheer this feat,
🐇✨ Simpler syncs can’t be beat!

✨ Finishing Touches
🧪 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.

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 (2)
.github/workflows/sync-docs-from-node.yml (2)

81-86: Token fallback is fine – but checkout may silently fail if both tokens are unset

actions/checkout@v4 fails only after attempting auth. A short pre-check avoids wasted minutes:

-token: ${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }}
+token: ${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }}
+# Fail fast if neither secret is present
+if: ${{ (secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN) != '' }}

Alternatively, abort earlier inside a small shell step.


519-523: Commit message generation relies on multi-line quoting – fragile on POSIX sh

git commit -m "<multiline>" is legal but some shells collapse newlines in double-quoted strings.
Use the standard two-flag form to guarantee formatting:

-git commit -m "docs: Sync documentation from node repository ${{ steps.params.outputs.version }}
-
- - Source: genlayerlabs/genlayer-node@${{ steps.params.outputs.version }}
- - Version: ${{ steps.params.outputs.version }}
- ..."
+git commit \
+  -m "docs: Sync documentation from node repository ${{ steps.params.outputs.version }}" \
+  -m "- Source: genlayerlabs/genlayer-node@${{ steps.params.outputs.version }}" \
+  -m "- Version: ${{ steps.params.outputs.version }}" \
+  -m "- Total changes: ${{ steps.check_changes.outputs.total_changes }}" \
+  -m "- Added: ${{ steps.check_changes.outputs.total_added }} files" \
+  -m "- Updated: ${{ steps.check_changes.outputs.total_updated }} files" \
+  -m "- Deleted: ${{ steps.check_changes.outputs.total_deleted }} files"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e21ec24 and 7213b7a.

📒 Files selected for processing (2)
  • .claude/prs/chore-nod-189-ci-automate-changelog.md (1 hunks)
  • .github/workflows/sync-docs-from-node.yml (7 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
.claude/prs/chore-nod-189-ci-automate-changelog.md (3)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed

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

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:69-72
Timestamp: 2025-07-14T09:14:00.225Z
Learning: The correct parameter name for enabling cone mode in sparse checkout for actions/checkout@v4 is sparse-checkout-cone-mode (not sparse-checkout-cone). This parameter should be set to true to enable cone mode for directory-based sparse checkout optimization.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - genlayer-docs
  • GitHub Check: Header rules - genlayer-docs
  • GitHub Check: Pages changed - genlayer-docs
🔇 Additional comments (3)
.github/workflows/sync-docs-from-node.yml (2)

8-10: 👍 Input consolidation looks correct

The new version input cleanly replaces the earlier source_branch/tag pair and is declared as required, preventing accidental empty runs.
No concerns here.


603-604: PR title string is good

Title correctly embeds the new version value; no action needed.

.claude/prs/chore-nod-189-ci-automate-changelog.md (1)

1-6: Documentation note is clear and concise

The changelog entry accurately reflects the workflow change. Nothing to add.

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: 0

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

74-79: Avoid duplicating default path values – keep single source of truth

The defaults for changelog_path, api_gen_path, api_debug_path, and their regex counterparts are now hard-coded twice: once in the workflow_dispatch.inputs block (lines 8-26) and again in this bash extraction (lines 68-79). If one side is updated but the other is forgotten the workflow silently diverges.

A lighter-maintenance pattern is to rely on the input default that GitHub already expands:

-echo "changelog_path=docs/changelog" >> $GITHUB_OUTPUT
-echo "api_gen_path=${{ github.event.inputs.api_gen_path || 'docs/api/rpc/gen' }}" >> $GITHUB_OUTPUT
-echo "api_debug_path=${{ github.event.inputs.api_debug_path || 'docs/api/rpc/debug' }}" >> $GITHUB_OUTPUT
-echo "api_gen_regex=${{ github.event.inputs.api_gen_regex || 'gen_(?!dbg_).*' }}" >> $GITHUB_OUTPUT
-echo "api_debug_regex=${{ github.event.inputs.api_debug_regex || 'gen_dbg_.*' }}" >> $GITHUB_OUTPUT
+echo "changelog_path=${{ github.event.inputs.changelog_path }}" >> $GITHUB_OUTPUT
+echo "api_gen_path=${{ github.event.inputs.api_gen_path }}" >> $GITHUB_OUTPUT
+echo "api_debug_path=${{ github.event.inputs.api_debug_path }}" >> $GITHUB_OUTPUT
+echo "api_gen_regex=${{ github.event.inputs.api_gen_regex }}" >> $GITHUB_OUTPUT
+echo "api_debug_regex=${{ github.event.inputs.api_debug_regex }}" >> $GITHUB_OUTPUT

This way the default lives only in the inputs: stanza, eliminating drift.

Also applies to: 68-70


62-67: Tiny robustness tweak for the null-safe check

Good call adding an early guard 👍. To stay consistent with previous guidance (see past review), consider keeping the null-coalescing fallback so the expression never errors if version is omitted entirely:

-if [ -z "${{ github.event.client_payload.version }}" ]; then
+if [ -z "${{ github.event.client_payload.version || '' }}" ]; then

Not critical, but prevents an Action-level “property doesn’t exist” failure.


96-99: Broaden sanitisation of version → branch name

Only replacing slashes still allows other characters (:, spaces, ~, etc.) that git refuses in ref names.

-VERSION="${{ steps.params.outputs.version }}"
-SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+VERSION="${{ steps.params.outputs.version }}"
+# Replace anything that is *not* alphanum, dot or hyphen
+SAFE_VERSION=$(echo "$VERSION" | tr -c 'A-Za-z0-9_.-' '-' )

Keeps refs valid regardless of how external systems name their tags.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8056410 and 2b57909.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (7 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
.github/workflows/sync-docs-from-node.yml (5)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:69-72
Timestamp: 2025-07-14T09:14:00.225Z
Learning: The correct parameter name for enabling cone mode in sparse checkout for actions/checkout@v4 is sparse-checkout-cone-mode (not sparse-checkout-cone). This parameter should be set to true to enable cone mode for directory-based sparse checkout optimization.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - genlayer-docs
  • GitHub Check: Header rules - genlayer-docs
  • GitHub Check: Pages changed - genlayer-docs
🔇 Additional comments (1)
.github/workflows/sync-docs-from-node.yml (1)

84-87: Fetch full history to ensure tag checkout reliability

actions/checkout@v4 does not fetch tags when fetch-depth is left at the default (1).
If version points to a lightweight tag the step may resolve an empty ref and fail.

-uses: actions/checkout@v4
+uses: actions/checkout@v4
 with:
   repository: genlayerlabs/genlayer-node
   ref: ${{ steps.params.outputs.version }}
+  fetch-depth: 0            # fetch tags/branches reliably

This adds a negligible cost (<1 s on GH runners) and removes an intermittent failure mode.

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: 1

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

96-103: Sanitisation covers “/” but not Git ref prefixes

If version arrives as a full ref (refs/tags/v0.3.5) or with spaces, the branch name will still break. Consider a more defensive scrub:

-VERSION="${{ steps.params.outputs.version }}"
-SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+VERSION="${{ steps.params.outputs.version }}"
+SAFE_VERSION=$(echo "$VERSION" \
+               | sed -e 's#^refs/[^/]*/##' \   # strip refs/heads|tags/
+                     -e 's/[^A-Za-z0-9._-]/-/g')  # replace anything unsafe

258-274: matches_pattern duplicated – extract once

The identical matches_pattern() helper is defined twice. Re-declare once near the top of the script (or source a reusable shell file) and call it from both sync blocks to keep things DRY and avoid future divergence.

Also applies to: 392-407


100-106: Trailing whitespace flagged by YAML-lint

YAML-lint errors show multiple trailing-space violations (lines ~100, 106, 257, 269, 347, 391, 397, 403, 481). Strip them to keep the workflow lint-clean.

-printf "- Deleted: \`%s\`\n" "$(basename "$dest_file")" >> $SYNC_REPORT␠
+printf "- Deleted: \`%s\`\n" "$(basename "$dest_file")" >> $SYNC_REPORT

Also applies to: 257-269, 347-351, 391-407, 481-485

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2b57909 and 5f8b4a6.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (15 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
.github/workflows/sync-docs-from-node.yml (6)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:69-72
Timestamp: 2025-07-14T09:14:00.225Z
Learning: The correct parameter name for enabling cone mode in sparse checkout for actions/checkout@v4 is sparse-checkout-cone-mode (not sparse-checkout-cone). This parameter should be set to true to enable cone mode for directory-based sparse checkout optimization.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 100-100: trailing spaces

(trailing-spaces)


[error] 106-106: trailing spaces

(trailing-spaces)


[error] 257-257: trailing spaces

(trailing-spaces)


[error] 263-263: trailing spaces

(trailing-spaces)


[error] 269-269: trailing spaces

(trailing-spaces)


[error] 347-347: trailing spaces

(trailing-spaces)


[error] 391-391: trailing spaces

(trailing-spaces)


[error] 397-397: trailing spaces

(trailing-spaces)


[error] 403-403: trailing spaces

(trailing-spaces)


[error] 481-481: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - genlayer-docs
  • GitHub Check: Header rules - genlayer-docs
  • GitHub Check: Pages changed - genlayer-docs
🔇 Additional comments (2)
.github/workflows/sync-docs-from-node.yml (2)

61-68: Early guard for version is solid – prevents cryptic failures.

The explicit check and hard-fail when client_payload.version is missing closes the gap called out in earlier reviews. ✅


86-88: Fallback token may still be empty for private forks

secrets.GITHUB_TOKEN only has cross-repo read on public repos. If genlayer-node is private and NODE_REPO_TOKEN is not set, the checkout will receive an empty string and silently fall back to actions/checkout’s unauthenticated mode → checkout of a private repo will fail.

token: ${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }}

Add a guard similar to the version check:

if [ -z "${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }}" ]; then
  echo "❌ Missing NODE_REPO_TOKEN (and GITHUB_TOKEN is insufficient for private repo)" >&2
  exit 1
fi

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: 1

♻️ Duplicate comments (1)
.github/workflows/sync-docs-from-node.yml (1)

569-570: git add fails when any listed directory is missing → broken workflow.

The previous review flagged this but the brittle command remains.

-git add content/validators pages/api-references pages/validators
+git add -A                     # add *whatever* changed

Alternatively, loop and add only existing paths.

Not fixing this means a no-op sync (e.g. only API docs changed) aborts with “fatal: pathspec… did not match any files”.

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

96-106: Branch-name sanitisation still allows illegal Git ref characters (space, ~, ^, :, ?).

Replacing slashes is a good start, but Git forbids several other bytes. A single liner covers all:

-SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+# Replace all chars disallowed by Git refs with ‘-’
+SAFE_VERSION=$(echo "$VERSION" | tr ' ~^:?*[]' '-' | sed 's#/##g')

Prevents accidental ref creation failures.


256-274: matches_pattern duplicated in two steps – factor out or source once.

The identical Bash function is defined in both API-sync steps. While harmless, duplication is noise and a maintenance hotspot.

Minimal change: move the function into an earlier step (e.g. a small prepare step that exports it) and source it in the later scripts, or extract to .github/scripts/match.sh.


1-672: Trim trailing whitespace – YAMLlint complaining.

Multiple lines flagged (100, 106, 258, …).

-printf "- Deleted: \`%s\`\n" "$(basename "$dest_file")" >> $SYNC_REPORT␠
+printf "- Deleted: \`%s\`\n" "$(basename "$dest_file")" >> $SYNC_REPORT

Run sed -i 's/[ \t]*$//' .github/workflows/sync-docs-from-node.yml or let prettier handle it.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5f8b4a6 and fcc8deb.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (16 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
.github/workflows/sync-docs-from-node.yml (8)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:69-72
Timestamp: 2025-07-14T09:14:00.225Z
Learning: The correct parameter name for enabling cone mode in sparse checkout for actions/checkout@v4 is sparse-checkout-cone-mode (not sparse-checkout-cone). This parameter should be set to true to enable cone mode for directory-based sparse checkout optimization.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 100-100: trailing spaces

(trailing-spaces)


[error] 106-106: trailing spaces

(trailing-spaces)


[error] 258-258: trailing spaces

(trailing-spaces)


[error] 264-264: trailing spaces

(trailing-spaces)


[error] 270-270: trailing spaces

(trailing-spaces)


[error] 348-348: trailing spaces

(trailing-spaces)


[error] 392-392: trailing spaces

(trailing-spaces)


[error] 398-398: trailing spaces

(trailing-spaces)


[error] 404-404: trailing spaces

(trailing-spaces)


[error] 482-482: trailing spaces

(trailing-spaces)

🔇 Additional comments (1)
.github/workflows/sync-docs-from-node.yml (1)

596-597: 👍 Safer push with --force-with-lease.
Protects against remote rewrites while still replacing the branch.

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: 1

♻️ Duplicate comments (2)
.github/workflows/sync-docs-from-node.yml (2)

570-571: git add aborts when any listed directory is missing

git add content/validators pages/api-references pages/validators fails if,
say, pages/validators doesn’t exist. Use a safer pattern:

-git add content/validators pages/api-references pages/validators
+git add -A                                         # or guard each dir exists

61-68: Guard still fails when version is the literal string "null"

GitHub replaces an absent JSON key with the string null, not an empty string.
[ -z "${{ github.event.client_payload.version }}" ] therefore passes, but later uses of the variable abort under set -u.

- if [ -z "${{ github.event.client_payload.version }}" ]; then
+raw_version='${{ github.event.client_payload.version }}'
+# treat both empty and "null" as missing
+if [ -z "$raw_version" ] || [ "$raw_version" = "null" ]; then
🧹 Nitpick comments (3)
.github/workflows/sync-docs-from-node.yml (3)

257-275: matches_pattern function duplicated – extract to a reusable step

The identical Bash function appears in both sync blocks, increasing maintenance
cost. A composite action or a small reusable script committed to the repo would
eliminate duplication and keep behaviour in one place.

Also applies to: 394-409


571-578: Multi-line commit message inside one -m can break quoting

The single -m option wraps the entire heredoc-like block; if an unescaped
" slips into any interpolated value the commit will fail. Prefer two -m
flags or a here-doc:

git commit -F- <<EOF
docs: Sync documentation from node repository ${{ steps.params.outputs.version }}

...
EOF

1-673: Trailing spaces flagged by YAMLlint

Lines 100, 106, 259, 265, 271, 349, 393, 399, 405 & 483 contain trailing
whitespace. Fix to keep the workflow lint-clean.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fcc8deb and 3f5eba7.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (16 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
.github/workflows/sync-docs-from-node.yml (8)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:69-72
Timestamp: 2025-07-14T09:14:00.225Z
Learning: The correct parameter name for enabling cone mode in sparse checkout for actions/checkout@v4 is sparse-checkout-cone-mode (not sparse-checkout-cone). This parameter should be set to true to enable cone mode for directory-based sparse checkout optimization.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 100-100: trailing spaces

(trailing-spaces)


[error] 106-106: trailing spaces

(trailing-spaces)


[error] 259-259: trailing spaces

(trailing-spaces)


[error] 265-265: trailing spaces

(trailing-spaces)


[error] 271-271: trailing spaces

(trailing-spaces)


[error] 349-349: trailing spaces

(trailing-spaces)


[error] 393-393: trailing spaces

(trailing-spaces)


[error] 399-399: trailing spaces

(trailing-spaces)


[error] 405-405: trailing spaces

(trailing-spaces)


[error] 483-483: trailing spaces

(trailing-spaces)

Comment on lines 96 to 105
# Sanitize version string for use in branch name
VERSION="${{ steps.params.outputs.version }}"
SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g') # replace any '/' with '-'
BRANCH_NAME="docs/node/${SAFE_VERSION}"

# Check if branch exists on remote
if git ls-remote --exit-code --heads origin "$BRANCH_NAME" >/dev/null 2>&1; then
echo "Branch $BRANCH_NAME already exists on remote, will force update"
git fetch origin "$BRANCH_NAME"
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Sanitisation incomplete – still allows spaces and other unsafe chars

Replacing / with - fixes path-like refs, but branch names may still contain
whitespace or exotic Unicode if a bad version is dispatched. Consider:

-SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+SAFE_VERSION=$(echo "$VERSION" | tr -c 'A-Za-z0-9._-]' '-' | sed 's/^-*//;s/-*$//')

This retains only safe characters and collapses runs of invalid ones to a
single -.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Sanitize version string for use in branch name
VERSION="${{ steps.params.outputs.version }}"
SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g') # replace any '/' with '-'
BRANCH_NAME="docs/node/${SAFE_VERSION}"
# Check if branch exists on remote
if git ls-remote --exit-code --heads origin "$BRANCH_NAME" >/dev/null 2>&1; then
echo "Branch $BRANCH_NAME already exists on remote, will force update"
git fetch origin "$BRANCH_NAME"
fi
# Sanitize version string for use in branch name
VERSION="${{ steps.params.outputs.version }}"
- SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g') # replace any '/' with '-'
+ SAFE_VERSION=$(echo "$VERSION" | tr -c 'A-Za-z0-9._-]' '-' | sed 's/^-*//;s/-*$//')
BRANCH_NAME="docs/node/${SAFE_VERSION}"
# Check if branch exists on remote
if git ls-remote --exit-code --heads origin "$BRANCH_NAME" >/dev/null 2>&1; then
echo "Branch $BRANCH_NAME already exists on remote, will force update"
git fetch origin "$BRANCH_NAME"
fi
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 100-100: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/sync-docs-from-node.yml around lines 96 to 105, the current
sanitization only replaces '/' with '-', which still allows spaces and other
unsafe characters in the branch name. Update the sanitization step to remove or
replace all unsafe characters by retaining only safe characters (e.g.,
alphanumerics, dots, dashes) and collapsing sequences of invalid characters into
a single '-'. This ensures the branch name is valid and safe for git operations.

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: 1

♻️ Duplicate comments (3)
.github/workflows/sync-docs-from-node.yml (3)

96-100: Sanitisation still allows space / Unicode chars – can break branch names

Only replacing slashes is insufficient. Consider the more robust filter already
proposed in the earlier review:

-VERSION="${{ steps.params.outputs.version }}"
-SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+VERSION="${{ steps.params.outputs.version }}"
+# keep [A–Z a–z 0–9 . _ -] collapse others to '-'
+SAFE_VERSION=$(echo "$VERSION" | tr -c 'A-Za-z0-9._-' '-' | sed 's/^-*//;s/-*$//')

570-571: git add fails when a listed path is absent (issue still unresolved)

Previous review noted this; the command is unchanged and will abort if, for
example, pages/validators has been deleted.
Use git add -A or conditional checks.


62-68: Guard also against literal null to avoid silent failures

github.event.client_payload.version resolves to the string null when the key is absent.
[ -z "null" ] is false, so the workflow continues and later checkout receives an invalid ref, reproducing the very bug this block is meant to prevent.

-if [ -z "${{ github.event.client_payload.version }}" ]; then
+raw_version='${{ github.event.client_payload.version }}'
+# Treat missing or literal "null" the same
+if [ -z "$raw_version" ] || [ "$raw_version" = "null" ]; then
🧹 Nitpick comments (2)
.github/workflows/sync-docs-from-node.yml (2)

165-166: Minor: mixed echo/printf – pick one style

You switched one deletion log line to printf but the rest of the file still
uses echo. For consistency (and to avoid future lint noise) adopt a single
style across the script.


259-275: Function duplication – extract once to .github/scripts/lib.sh

matches_pattern() is declared twice (gen/debug). Duplicated code increases
maintenance cost; a tiny helper shell script sourced in both steps avoids this.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3f5eba7 and 973d808.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (16 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
.github/workflows/sync-docs-from-node.yml (8)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:69-72
Timestamp: 2025-07-14T09:14:00.225Z
Learning: The correct parameter name for enabling cone mode in sparse checkout for actions/checkout@v4 is sparse-checkout-cone-mode (not sparse-checkout-cone). This parameter should be set to true to enable cone mode for directory-based sparse checkout optimization.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 100-100: trailing spaces

(trailing-spaces)


[error] 106-106: trailing spaces

(trailing-spaces)


[error] 259-259: trailing spaces

(trailing-spaces)


[error] 265-265: trailing spaces

(trailing-spaces)


[error] 271-271: trailing spaces

(trailing-spaces)


[error] 349-349: trailing spaces

(trailing-spaces)


[error] 393-393: trailing spaces

(trailing-spaces)


[error] 399-399: trailing spaces

(trailing-spaces)


[error] 405-405: trailing spaces

(trailing-spaces)


[error] 483-483: trailing spaces

(trailing-spaces)

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: 0

♻️ Duplicate comments (4)
.github/workflows/sync-docs-from-node.yml (4)

62-68: Guard still fails when version is literally null

If the dispatch payload omits the version key entirely, the expression ${{ github.event.client_payload.version }} is rendered as the literal string null.
With set -u enabled, later uses of $VERSION (e.g. in git checkout) will abort the script because null is not empty and does not point to a valid ref.

-VERSION="${{ github.event.client_payload.version }}"
-if [ -z "$VERSION" ]; then
-  VERSION="latest"
-fi
+raw_version='${{ github.event.client_payload.version }}'
+# Treat "null" as unset
+if [ -z "$raw_version" ] || [ "$raw_version" = "null" ]; then
+  VERSION="latest"
+else
+  VERSION="$raw_version"
+fi

85-89: NODE_REPO_TOKEN || GITHUB_TOKEN fallback is still invalid for secrets

GitHub Actions treats an unset secret as a hard error – the whole job fails before the step even starts.
The safe pattern is to reference one secret and ensure it is always defined (e.g. set NODE_REPO_TOKEN in the repo to the same value as GITHUB_TOKEN if a dedicated token is not provided).

-  token: ${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }}
+  token: ${{ secrets.NODE_REPO_TOKEN }}

134-137: Branch-name sanitisation still allows unsafe characters

Only / is replaced, so spaces or other invalid ref characters can still sneak through, creating refs Git refuses to push.

Consider the more comprehensive pattern previously suggested:

-SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+SAFE_VERSION=$(echo "$VERSION" | tr -c 'A-Za-z0-9._-]' '-' | sed 's/^-*//;s/-*$//')

626-627: git add aborts when any listed directory is absent

If, for example, pages/validators doesn’t exist in this PR, git add exits non-zero and the workflow stops.
Use a safer variant:

-git add content/validators pages/api-references pages/validators
+git add -A
🧹 Nitpick comments (3)
.github/workflows/sync-docs-from-node.yml (3)

318-331: Possible pattern-injection & globbing issues in matches_pattern

$pattern comes from user input and is inserted directly into the Perl one-liner inside double quotes.
A malicious pattern could break the command or execute arbitrary Perl code. At a minimum, wrap the variable in single quotes and pass it via -e:

-echo "$filename" | perl -ne "exit 0 if /^($pattern)\$/; exit 1"
+perl -e 'exit 0 if shift =~ /^('"$pattern"')$/; exit 1' -- "$filename"

Also quote $pattern in the grep fallback:

-echo "$filename" | grep -E "^($pattern)$" >/dev/null 2>&1
+echo "$filename" | grep -E "^(${pattern})$" >/dev/null 2>&1

451-465: Duplicate matches_pattern implementation – consider reuse

The identical function is duplicated for debug-method syncing. Move it to a reusable script or a preceding step and source it to avoid divergence.


1-729: Trailing whitespace flagged by YAMLlint

Multiple lines contain trailing spaces (see YAMLlint output).
While cosmetic, this fails stricter CI linters and can be fixed automatically with prettier --write or yarn lint:fix.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 51718c9 and 713085e.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (16 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
.github/workflows/sync-docs-from-node.yml (7)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 98-98: trailing spaces

(trailing-spaces)


[error] 103-103: trailing spaces

(trailing-spaces)


[error] 122-122: trailing spaces

(trailing-spaces)


[error] 137-137: trailing spaces

(trailing-spaces)


[error] 143-143: trailing spaces

(trailing-spaces)


[error] 240-240: trailing spaces

(trailing-spaces)


[error] 250-250: trailing spaces

(trailing-spaces)


[error] 256-256: trailing spaces

(trailing-spaces)


[error] 275-275: trailing spaces

(trailing-spaces)


[error] 315-315: trailing spaces

(trailing-spaces)


[error] 321-321: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


[error] 405-405: trailing spaces

(trailing-spaces)


[error] 449-449: trailing spaces

(trailing-spaces)


[error] 455-455: trailing spaces

(trailing-spaces)


[error] 461-461: trailing spaces

(trailing-spaces)


[error] 539-539: trailing spaces

(trailing-spaces)

…mmit process in sync-docs-from-node workflow
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: 0

♻️ Duplicate comments (4)
.github/workflows/sync-docs-from-node.yml (4)

63-67: Missing "null" guard – still breaks when version key is omitted

Past review already highlighted that ${{ github.event.client_payload.version }} can be rendered as the literal string null.
The current check only treats an empty string as “unset”, so VERSION="null" slips through and leads to an invalid checkout ref.


86-88: Secret fallback with || is still unsafe

token: ${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }} will explode if NODE_REPO_TOKEN is not defined because GitHub blocks access to an undefined secret before evaluating ||.
The previously-suggested runtime fallback (store the same value in both secrets, or select in a shell step) has not been applied.


133-138: Branch-name sanitisation still only replaces “/”

The replacement fixes path-like refs but still allows spaces and other illegal characters.
Prior review proposed retaining [A-Za-z0-9._-] only and collapsing invalid runs to “-”.

Example patch:

-VERSION="${{ steps.set_version.outputs.version }}"
-SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+RAW_VERSION="${{ steps.set_version.outputs.version }}"
+SAFE_VERSION=$(echo "$RAW_VERSION" | tr -c 'A-Za-z0-9._-' '-' | sed 's/^-*//;s/-*$//')

662-670: git add fails when any listed directory is absent

git add content/validators pages/api-references pages/validators aborts the commit if one of the paths does not exist.
Safer options previously suggested (e.g. git add -A or conditional adds) remain unimplemented.

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

352-367: matches_pattern duplicated – extract once to avoid drift

The identical helper is declared twice (gen & debug sections).
Define it once (e.g. in an earlier run: step and source it, or place it in a reusable action) to keep behaviour consistent and shrink the workflow.

Also applies to: 486-501


95-103: Trailing whitespace trips YAML-lint

Multiple changed lines contain stray spaces reported by YAML-lint.
Cleaning them up keeps CI green and the file tidy.

Also applies to: 120-122, 137-143, 240-241

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 713085e and a9e00ed.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (15 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
.github/workflows/sync-docs-from-node.yml (7)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 98-98: trailing spaces

(trailing-spaces)


[error] 103-103: trailing spaces

(trailing-spaces)


[error] 122-122: trailing spaces

(trailing-spaces)


[error] 137-137: trailing spaces

(trailing-spaces)


[error] 143-143: trailing spaces

(trailing-spaces)


[error] 240-240: trailing spaces

(trailing-spaces)


[error] 250-250: trailing spaces

(trailing-spaces)


[error] 256-256: trailing spaces

(trailing-spaces)


[error] 280-280: trailing spaces

(trailing-spaces)


[error] 286-286: trailing spaces

(trailing-spaces)


[error] 298-298: trailing spaces

(trailing-spaces)


[error] 318-318: trailing spaces

(trailing-spaces)


[error] 328-328: trailing spaces

(trailing-spaces)


[error] 351-351: trailing spaces

(trailing-spaces)


[error] 357-357: trailing spaces

(trailing-spaces)


[error] 363-363: trailing spaces

(trailing-spaces)


[error] 441-441: trailing spaces

(trailing-spaces)


[error] 485-485: trailing spaces

(trailing-spaces)


[error] 491-491: trailing spaces

(trailing-spaces)


[error] 497-497: trailing spaces

(trailing-spaces)


[error] 575-575: trailing spaces

(trailing-spaces)


[error] 667-667: trailing spaces

(trailing-spaces)


[error] 669-669: trailing spaces

(trailing-spaces)


[error] 676-676: trailing spaces

(trailing-spaces)

…mmit process in sync-docs-from-node workflow
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: 0

♻️ Duplicate comments (4)
.github/workflows/sync-docs-from-node.yml (4)

69-73: Version handling needs improvement for repository_dispatch.

The current logic doesn't handle the case where client_payload.version is missing or null from repository_dispatch events, which could cause issues downstream.

Based on past review comments, this issue should have been addressed in commit e99f5b5, but the current code still shows the simplified version without the null check.


142-154: Branch name sanitization is incomplete.

The current sanitization only replaces / with -, but branch names could still contain other unsafe characters like spaces or special Unicode characters.

Based on past review comments, this should have been addressed, but the current implementation still only handles forward slashes.


92-92: Token fallback pattern needs correction.

The expression ${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }} will fail if NODE_REPO_TOKEN is not set, as GitHub Actions cannot access undefined secrets.

Based on past review comments, this issue should have been addressed by using only NODE_REPO_TOKEN and setting it at the repository level.


739-739: Git add command may fail with missing paths.

The command git add content/validators pages/api-references pages/validators will fail if any of the specified directories don't exist or have no changes.

Based on past review comments, this should be addressed by using a safer approach like git add -A or checking for directory existence before adding.

🧹 Nitpick comments (1)
.github/workflows/sync-docs-from-node.yml (1)

51-51: Remove trailing spaces throughout the file.

YAMLlint has flagged multiple lines with trailing spaces, which should be cleaned up for consistency and to pass linting checks.

# Remove trailing spaces from all flagged lines
# This can be done with: sed -i 's/[[:space:]]*$//' .github/workflows/sync-docs-from-node.yml

Also applies to: 107-107, 112-112, 131-131, 145-145, 151-151, 248-248, 265-265, 271-271, 274-274, 281-281, 286-286, 293-293, 298-298, 308-308, 324-324, 339-339, 351-351, 371-371, 381-381, 404-404, 410-410, 416-416, 494-494, 538-538, 544-544, 550-550, 628-628, 678-678, 738-738, 740-740, 747-747

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a9e00ed and bc84e0a.

📒 Files selected for processing (2)
  • .github/scripts/sanitize-config.py (1 hunks)
  • .github/workflows/sync-docs-from-node.yml (16 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
.github/workflows/sync-docs-from-node.yml (7)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 51-51: trailing spaces

(trailing-spaces)


[error] 107-107: trailing spaces

(trailing-spaces)


[error] 112-112: trailing spaces

(trailing-spaces)


[error] 131-131: trailing spaces

(trailing-spaces)


[error] 145-145: trailing spaces

(trailing-spaces)


[error] 151-151: trailing spaces

(trailing-spaces)


[error] 248-248: trailing spaces

(trailing-spaces)


[error] 265-265: trailing spaces

(trailing-spaces)


[error] 271-271: trailing spaces

(trailing-spaces)


[error] 274-274: trailing spaces

(trailing-spaces)


[error] 281-281: trailing spaces

(trailing-spaces)


[error] 286-286: trailing spaces

(trailing-spaces)


[error] 293-293: trailing spaces

(trailing-spaces)


[error] 298-298: trailing spaces

(trailing-spaces)


[error] 308-308: trailing spaces

(trailing-spaces)


[error] 324-324: trailing spaces

(trailing-spaces)


[error] 339-339: trailing spaces

(trailing-spaces)


[error] 351-351: trailing spaces

(trailing-spaces)


[error] 371-371: trailing spaces

(trailing-spaces)


[error] 381-381: trailing spaces

(trailing-spaces)


[error] 404-404: trailing spaces

(trailing-spaces)


[error] 410-410: trailing spaces

(trailing-spaces)


[error] 416-416: trailing spaces

(trailing-spaces)


[error] 494-494: trailing spaces

(trailing-spaces)


[error] 538-538: trailing spaces

(trailing-spaces)


[error] 544-544: trailing spaces

(trailing-spaces)


[error] 550-550: trailing spaces

(trailing-spaces)


[error] 628-628: trailing spaces

(trailing-spaces)


[error] 678-678: trailing spaces

(trailing-spaces)


[error] 738-738: trailing spaces

(trailing-spaces)


[error] 740-740: trailing spaces

(trailing-spaces)


[error] 747-747: trailing spaces

(trailing-spaces)

🔇 Additional comments (13)
.github/scripts/sanitize-config.py (1)

15-15: Debug output enhancements look good.

The added debug print statements provide excellent visibility into the sanitization process, which will be helpful for troubleshooting workflow issues. The output includes file paths, section discovery, and removal tracking without exposing sensitive configuration values.

Also applies to: 21-26, 28-28, 32-32, 35-35, 37-40, 46-46

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

51-56: Python dependency installation is correctly placed.

The Python dependencies setup is appropriately added before the Git configuration step, ensuring PyYAML is available for the config sanitization script.


8-11: Version parameter consolidation simplifies the workflow.

The consolidation of separate source_branch and tag parameters into a single version parameter with "latest" as default is a good improvement. The unified API paths to docs/api/rpc also eliminate confusion.

Also applies to: 15-15, 19-19, 75-76, 80-80, 82-83


100-115: Latest version detection logic is robust.

The automatic detection of the latest semantic version tag using git tag -l | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1 is a solid approach. The error handling for when no tags are found is appropriate.


93-93: Fetch depth and sparse checkout optimization.

Using fetch-depth: 0 to get all tags for version detection and sparse checkout for only docs and configs directories is an excellent optimization that reduces clone time and storage.

Also applies to: 96-96


249-262: Extensive debug logging enhances troubleshooting.

The comprehensive debug output for config sync operations provides excellent visibility into directory structure, file contents, and sanitization process. This will be invaluable for diagnosing sync issues.

Also applies to: 266-270, 282-297, 300-323, 325-339, 341-350, 372-380


288-292: Robust sed replacement with backup handling.

The sed commands with backup file creation and cleanup handle cross-platform compatibility well. The URL replacement patterns correctly target the zksync configuration fields.


407-420: Perl-first regex matching with grep fallback is excellent.

The matches_pattern function that prioritizes perl for PCRE support (including negative lookahead) and falls back to grep -E is a smart solution for handling complex regex patterns across different environments.

Also applies to: 541-554


210-210: Consistent printf usage for safe string formatting.

Using printf -- "- Deleted: \%s`\n"instead ofecho` for formatted output is the correct approach to handle filenames that might start with dashes or contain special characters.

Also applies to: 387-387, 402-402, 497-497, 536-536, 631-631


679-695: Final config verification adds valuable safety check.

The comprehensive verification that checks for sensitive sections and TODO placeholders in the final config.yaml provides an important safety net to ensure sanitization worked correctly.


733-747: Git operation debugging improves transparency.

The debug groups showing git status before and after staging operations, with specific checks for config.yaml files, will help diagnose commit-related issues.


748-752: Commit and PR messages correctly reference version.

The updated commit messages and PR titles properly reference the consolidated version parameter instead of the old tag or source_branch parameters, maintaining consistency with the parameter consolidation.

Also applies to: 801-801, 832-832


774-774: Force push with lease is the safe approach.

Using --force-with-lease instead of --force provides protection against accidentally overwriting changes made by others, which is the correct approach for automated workflows.

@dohernandez dohernandez force-pushed the chore/nod-189-ci-automate-changelog branch 4 times, most recently from 92c0dd7 to 2e9ab00 Compare July 26, 2025 11:29
@dohernandez dohernandez force-pushed the chore/nod-189-ci-automate-changelog branch from 2e9ab00 to fb48029 Compare July 26, 2025 11:35
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: 1

♻️ Duplicate comments (2)
.github/workflows/sync-docs-from-node.yml (2)

148-150: Branch sanitization is incomplete.

The current sanitization only replaces '/' with '-', but as noted in previous reviews, this still allows spaces and other unsafe characters in branch names.

Consider the more comprehensive sanitization suggested in previous reviews:

-SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+SAFE_VERSION=$(echo "$VERSION" | tr -c 'A-Za-z0-9._-' '-' | sed 's/^-*//;s/-*$//')

This retains only safe characters and collapses runs of invalid ones to a single '-'.


804-804: Git add command may still fail with missing paths.

As noted in previous reviews, git add content/validators pages/api-references pages/validators can fail if any specified path doesn't exist. Consider using git add -A or checking path existence first.

🧹 Nitpick comments (1)
.github/workflows/sync-docs-from-node.yml (1)

51-51: Clean up trailing spaces throughout the file.

YAMLlint has flagged multiple lines with trailing spaces. While these don't affect functionality, they should be cleaned up for better code quality and to pass linting checks.

Run the following command to remove all trailing spaces:

sed -i 's/[[:space:]]*$//' .github/workflows/sync-docs-from-node.yml

Also applies to: 107-107, 112-112, 131-131, 151-151, 157-157, 249-249, 255-255, 270-270, 275-275, 281-281, 284-284, 291-291, 296-296, 303-303, 308-308, 318-318, 334-334, 347-347, 355-355, 361-361, 367-367, 377-377, 389-389, 398-398, 419-419, 437-437, 445-445, 448-448, 469-469, 475-475, 481-481, 559-559, 603-603, 609-609, 615-615, 693-693, 743-743, 803-803, 805-805, 812-812, 856-856, 870-870

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bc84e0a and 493a9db.

📒 Files selected for processing (2)
  • .github/scripts/sanitize-config.py (1 hunks)
  • .github/workflows/sync-docs-from-node.yml (17 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
.github/workflows/sync-docs-from-node.yml (7)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 51-51: trailing spaces

(trailing-spaces)


[error] 107-107: trailing spaces

(trailing-spaces)


[error] 112-112: trailing spaces

(trailing-spaces)


[error] 131-131: trailing spaces

(trailing-spaces)


[error] 151-151: trailing spaces

(trailing-spaces)


[error] 157-157: trailing spaces

(trailing-spaces)


[error] 249-249: trailing spaces

(trailing-spaces)


[error] 255-255: trailing spaces

(trailing-spaces)


[error] 270-270: trailing spaces

(trailing-spaces)


[error] 275-275: trailing spaces

(trailing-spaces)


[error] 281-281: trailing spaces

(trailing-spaces)


[error] 284-284: trailing spaces

(trailing-spaces)


[error] 291-291: trailing spaces

(trailing-spaces)


[error] 296-296: trailing spaces

(trailing-spaces)


[error] 303-303: trailing spaces

(trailing-spaces)


[error] 308-308: trailing spaces

(trailing-spaces)


[error] 318-318: trailing spaces

(trailing-spaces)


[error] 334-334: trailing spaces

(trailing-spaces)


[error] 347-347: trailing spaces

(trailing-spaces)


[error] 355-355: trailing spaces

(trailing-spaces)


[error] 361-361: trailing spaces

(trailing-spaces)


[error] 367-367: trailing spaces

(trailing-spaces)


[error] 377-377: trailing spaces

(trailing-spaces)


[error] 389-389: trailing spaces

(trailing-spaces)


[error] 398-398: trailing spaces

(trailing-spaces)


[error] 419-419: trailing spaces

(trailing-spaces)


[error] 437-437: trailing spaces

(trailing-spaces)


[error] 445-445: trailing spaces

(trailing-spaces)


[error] 448-448: trailing spaces

(trailing-spaces)


[error] 469-469: trailing spaces

(trailing-spaces)


[error] 475-475: trailing spaces

(trailing-spaces)


[error] 481-481: trailing spaces

(trailing-spaces)


[error] 559-559: trailing spaces

(trailing-spaces)


[error] 603-603: trailing spaces

(trailing-spaces)


[error] 609-609: trailing spaces

(trailing-spaces)


[error] 615-615: trailing spaces

(trailing-spaces)


[error] 693-693: trailing spaces

(trailing-spaces)


[error] 743-743: trailing spaces

(trailing-spaces)


[error] 803-803: trailing spaces

(trailing-spaces)


[error] 805-805: trailing spaces

(trailing-spaces)


[error] 812-812: trailing spaces

(trailing-spaces)


[error] 856-856: trailing spaces

(trailing-spaces)


[error] 870-870: trailing spaces

(trailing-spaces)

🔇 Additional comments (9)
.github/scripts/sanitize-config.py (3)

10-16: LGTM! Clean transition to regex-based processing.

The import change and updated docstring correctly reflect the shift from YAML parsing to regex-based text processing.


17-22: Good approach for plain text processing.

Reading the entire file as text and logging the file size provides good debugging information for the regex-based sanitization.


37-42: File writing and debug output look good.

The approach to write back the sanitized content and log the final file size provides good traceability for debugging.

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

8-86: Excellent consolidation of version parameters.

The changes successfully implement the PR objective of consolidating source_branch and tag into a single version parameter. The unified API path defaults and proper handling of both dispatch types improve workflow clarity.


100-143: Robust version detection with good error handling.

The automatic detection of the latest semantic version tag is well-implemented with proper error handling and comprehensive debugging output. The regex pattern correctly filters semantic versions.


256-376: Excellent debugging enhancement for config sync.

The comprehensive debugging output will significantly improve troubleshooting of the config sanitization process. The verification steps ensure the sanitization worked correctly.


470-485: Smart regex matching with PCRE support.

The matches_pattern function is a well-designed solution that provides PCRE support through perl while maintaining compatibility with systems that only have grep. This addresses the limitations with negative lookahead patterns in the API filtering.


839-839: Good use of --force-with-lease for safer force push.

Using --force-with-lease instead of --force provides better safety by ensuring the remote branch hasn't been updated by someone else since the last fetch.


853-872: Smart PR creation logic prevents duplicates.

The logic to check for existing PRs and only create new ones when necessary is a good improvement. Properly handling both open and closed PR states prevents workflow conflicts.

Comment on lines +23 to +36
# Remove node.admin section
# This regex matches the admin: line and all indented content that follows
admin_pattern = r'(\n\s+admin:\s*\n(?:\s+(?:port:\s*\d+|\S.*)\s*\n)*)'
if re.search(admin_pattern, content):
content = re.sub(admin_pattern, '\n', content)
print("Removed node.admin section")

# Write back to file preserving the structure
# Remove node.dev section
# This regex matches the dev: line and all indented content that follows
dev_pattern = r'(\n\s+dev:\s*\n(?:\s+\S.*\s*\n)*)'
if re.search(dev_pattern, content):
content = re.sub(dev_pattern, '\n', content)
print("Removed node.dev section")

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Regex patterns may be unreliable for YAML parsing.

The regex patterns have several potential issues:

  1. Restrictive admin pattern: The pattern port:\s*\d+|\S.* is too specific and may miss other admin configuration fields
  2. Missing edge cases: Patterns require leading newlines, potentially missing sections at file start
  3. YAML structure assumptions: The patterns assume specific indentation which may vary

Consider more robust patterns:

-admin_pattern = r'(\n\s+admin:\s*\n(?:\s+(?:port:\s*\d+|\S.*)\s*\n)*)'
+admin_pattern = r'(\n?\s*admin:\s*\n(?:\s+.*\n)*)'
-dev_pattern = r'(\n\s+dev:\s*\n(?:\s+\S.*\s*\n)*)'
+dev_pattern = r'(\n?\s*dev:\s*\n(?:\s+.*\n)*)'

Or consider keeping the YAML parsing approach for reliability, as structured data parsing is inherently more robust than regex for this use case.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Remove node.admin section
# This regex matches the admin: line and all indented content that follows
admin_pattern = r'(\n\s+admin:\s*\n(?:\s+(?:port:\s*\d+|\S.*)\s*\n)*)'
if re.search(admin_pattern, content):
content = re.sub(admin_pattern, '\n', content)
print("Removed node.admin section")
# Write back to file preserving the structure
# Remove node.dev section
# This regex matches the dev: line and all indented content that follows
dev_pattern = r'(\n\s+dev:\s*\n(?:\s+\S.*\s*\n)*)'
if re.search(dev_pattern, content):
content = re.sub(dev_pattern, '\n', content)
print("Removed node.dev section")
# Remove node.admin section
# This regex matches the admin: line and all indented content that follows
admin_pattern = r'(\n?\s*admin:\s*\n(?:\s+.*\n)*)'
if re.search(admin_pattern, content):
content = re.sub(admin_pattern, '\n', content)
print("Removed node.admin section")
# Remove node.dev section
# This regex matches the dev: line and all indented content that follows
dev_pattern = r'(\n?\s*dev:\s*\n(?:\s+.*\n)*)'
if re.search(dev_pattern, content):
content = re.sub(dev_pattern, '\n', content)
print("Removed node.dev section")
🤖 Prompt for AI Agents
In .github/scripts/sanitize-config.py around lines 23 to 36, the current regex
patterns for removing the node.admin and node.dev sections are too restrictive,
rely on specific indentation and leading newlines, and may miss valid YAML
structures. To fix this, replace the regex-based removal with a YAML parsing
approach: load the content as YAML, remove the 'admin' and 'dev' keys from the
'node' section if present, then dump the YAML back to string. This ensures
reliable and accurate removal regardless of formatting or indentation
variations.

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: 1

🔭 Outside diff range comments (1)
.github/workflows/sync-docs-from-node.yml (1)

744-755: Arithmetic uses raw outputs that may be empty → bash: syntax error: operand expected

When an output is absent the expression ${{ steps.* || 0 }} is replaced by an empty string, not 0.
With set -euo pipefail, the arithmetic expansion aborts.

-TOTAL_ADDED=$(( ${{ steps.sync_changelog.outputs.changelog_added || 0 }} + \
-               ${{ steps.sync_api_gen.outputs.api_gen_added || 0 }} + \
-               ${{ steps.sync_api_debug.outputs.api_debug_added || 0 }} ))
+TOTAL_ADDED=$(( ${{
+  steps.sync_changelog.outputs.changelog_added }}0 + \
+  ${{ steps.sync_api_gen.outputs.api_gen_added }}0 + \
+  ${{ steps.sync_api_debug.outputs.api_debug_added }}0 ))

Alternatively assign each output to a shell variable with a default (${var:-0}) before arithmetic.

♻️ Duplicate comments (3)
.github/workflows/sync-docs-from-node.yml (3)

92-93: secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN is still invalid in Actions expressions

GitHub expressions cannot read an unset secret – the step will fail before your fallback is evaluated.
Provide only secrets.NODE_REPO_TOKEN here and set that secret to GITHUB_TOKEN at repository level if a dedicated token is not configured.
This was flagged previously but remains unchanged.


147-151: Branch-name sanitisation still too narrow

Replacing only / leaves spaces and other illegal ref characters unhandled (e.g. release candidate/v0.4.0).
Please extend sanitisation to allow [A-Za-z0-9._-] only and collapse invalid runs.
This mirrors prior feedback.


778-785: git add aborts when any listed path is absent

The command still lists fixed directories; if one is missing the step fails.
Use git add -A or conditionally add existing directories.
Same issue was pointed out earlier.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 493a9db and f5d2fba.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (19 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
.github/workflows/sync-docs-from-node.yml (7)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 51-51: trailing spaces

(trailing-spaces)


[error] 107-107: trailing spaces

(trailing-spaces)


[error] 112-112: trailing spaces

(trailing-spaces)


[error] 131-131: trailing spaces

(trailing-spaces)


[error] 151-151: trailing spaces

(trailing-spaces)


[error] 157-157: trailing spaces

(trailing-spaces)


[error] 249-249: trailing spaces

(trailing-spaces)


[error] 255-255: trailing spaces

(trailing-spaces)


[error] 270-270: trailing spaces

(trailing-spaces)


[error] 275-275: trailing spaces

(trailing-spaces)


[error] 281-281: trailing spaces

(trailing-spaces)


[error] 284-284: trailing spaces

(trailing-spaces)


[error] 291-291: trailing spaces

(trailing-spaces)


[error] 296-296: trailing spaces

(trailing-spaces)


[error] 303-303: trailing spaces

(trailing-spaces)


[error] 308-308: trailing spaces

(trailing-spaces)


[error] 318-318: trailing spaces

(trailing-spaces)


[error] 334-334: trailing spaces

(trailing-spaces)


[error] 347-347: trailing spaces

(trailing-spaces)


[error] 355-355: trailing spaces

(trailing-spaces)


[error] 361-361: trailing spaces

(trailing-spaces)


[error] 367-367: trailing spaces

(trailing-spaces)


[error] 377-377: trailing spaces

(trailing-spaces)


[error] 389-389: trailing spaces

(trailing-spaces)


[error] 398-398: trailing spaces

(trailing-spaces)


[error] 419-419: trailing spaces

(trailing-spaces)


[error] 437-437: trailing spaces

(trailing-spaces)


[error] 445-445: trailing spaces

(trailing-spaces)


[error] 448-448: trailing spaces

(trailing-spaces)


[error] 469-469: trailing spaces

(trailing-spaces)


[error] 475-475: trailing spaces

(trailing-spaces)


[error] 481-481: trailing spaces

(trailing-spaces)


[error] 546-546: trailing spaces

(trailing-spaces)


[error] 590-590: trailing spaces

(trailing-spaces)


[error] 596-596: trailing spaces

(trailing-spaces)


[error] 602-602: trailing spaces

(trailing-spaces)


[error] 667-667: trailing spaces

(trailing-spaces)


[error] 717-717: trailing spaces

(trailing-spaces)


[error] 777-777: trailing spaces

(trailing-spaces)


[error] 779-779: trailing spaces

(trailing-spaces)


[error] 786-786: trailing spaces

(trailing-spaces)


[error] 830-830: trailing spaces

(trailing-spaces)


[error] 844-844: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - genlayer-docs
  • GitHub Check: Header rules - genlayer-docs
  • GitHub Check: Pages changed - genlayer-docs

Comment on lines +68 to 74
# Default to "latest" if version not provided
VERSION="${{ github.event.client_payload.version }}"
if [ -z "$VERSION" ]; then
VERSION="latest"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "changelog_path=${{ github.event.client_payload.changelog_path || 'docs/changelog' }}" >> $GITHUB_OUTPUT
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Guard also against the literal "null" returned by missing inputs

${{ github.event.client_payload.version }} expands to the string null when the key is absent.
-z "$VERSION" doesn’t catch that, so an invalid ref (null) may be checked-out, breaking the workflow.

-VERSION="${{ github.event.client_payload.version }}"
-if [ -z "$VERSION" ]; then
-  VERSION="latest"
-fi
+raw_version='${{ github.event.client_payload.version }}'
+# Treat empty or "null" as unset
+if [ -z "$raw_version" ] || [ "$raw_version" = "null" ]; then
+  VERSION="latest"
+else
+  VERSION="$raw_version"
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Default to "latest" if version not provided
VERSION="${{ github.event.client_payload.version }}"
if [ -z "$VERSION" ]; then
VERSION="latest"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "changelog_path=${{ github.event.client_payload.changelog_path || 'docs/changelog' }}" >> $GITHUB_OUTPUT
# Default to "latest" if version not provided
raw_version='${{ github.event.client_payload.version }}'
# Treat empty or "null" as unset
if [ -z "$raw_version" ] || [ "$raw_version" = "null" ]; then
VERSION="latest"
else
VERSION="$raw_version"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "changelog_path=${{ github.event.client_payload.changelog_path || 'docs/changelog' }}" >> $GITHUB_OUTPUT
🤖 Prompt for AI Agents
In .github/workflows/sync-docs-from-node.yml around lines 68 to 74, the script
sets VERSION from github.event.client_payload.version but does not handle the
case where this expands to the literal string "null". Update the condition to
check if VERSION is empty or equals "null" and in either case set VERSION to
"latest" to prevent using an invalid ref. This ensures the workflow does not
break due to an invalid version value.

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: 0

♻️ Duplicate comments (4)
.github/workflows/sync-docs-from-node.yml (4)

68-74: Guard against literal "null" when version is missing

${{ github.event.client_payload.version }} expands to the string null when the key is absent.
The current check only tests for an empty string, so "null" slips through and becomes an invalid ref.

-VERSION="${{ github.event.client_payload.version }}"
-if [ -z "$VERSION" ]; then
-  VERSION="latest"
-fi
+RAW_VERSION='${{ github.event.client_payload.version }}'
+# Treat empty or "null" as unset
+if [ -z "$RAW_VERSION" ] || [ "$RAW_VERSION" = "null" ]; then
+  VERSION="latest"
+else
+  VERSION="$RAW_VERSION"
+fi

91-93: || fallback with secrets is still invalid

secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN is not permitted—referencing an unset secret aborts evaluation before the fallback is considered.
Use a single secret here and set NODE_REPO_TOKEN to GITHUB_TOKEN at the repository level if no dedicated token exists.

-token: ${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }}
+token: ${{ secrets.NODE_REPO_TOKEN }}

160-162: Branch-name sanitisation still too narrow

Replacing only / leaves other illegal characters (spaces, unicode, etc.). Reuse the earlier suggestion to retain [A-Za-z0-9._-] and collapse everything else:

-SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+SAFE_VERSION=$(echo "$VERSION" | tr -c 'A-Za-z0-9._-' '-' | sed 's/^-*//;s/-*$//')

802-803: git add fails when a listed path is absent

If any of pages/validators etc. don’t exist, the command aborts and the workflow hard-fails.
Either use git add -A or conditionally add directories.

-git add content/validators pages/api-references pages/validators
+git add -A          # safer: adds only existing paths
🧹 Nitpick comments (1)
.github/workflows/sync-docs-from-node.yml (1)

51-56: Minor: unnecessary PyYAML install

The sanitisation script now uses regex, not YAML parsing; pyyaml is no longer required.
Dropping the install will save ~10 s of workflow time.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f5d2fba and 49bef72.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (19 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update configuration examples with new contract addresses in setup-guide.mdx when applicable
.github/workflows/sync-docs-from-node.yml (7)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 51-51: trailing spaces

(trailing-spaces)


[error] 107-107: trailing spaces

(trailing-spaces)


[error] 112-112: trailing spaces

(trailing-spaces)


[error] 131-131: trailing spaces

(trailing-spaces)


[error] 157-157: trailing spaces

(trailing-spaces)


[error] 162-162: trailing spaces

(trailing-spaces)


[error] 164-164: trailing spaces

(trailing-spaces)


[error] 167-167: trailing spaces

(trailing-spaces)


[error] 173-173: trailing spaces

(trailing-spaces)


[error] 180-180: trailing spaces

(trailing-spaces)


[error] 182-182: trailing spaces

(trailing-spaces)


[error] 273-273: trailing spaces

(trailing-spaces)


[error] 279-279: trailing spaces

(trailing-spaces)


[error] 294-294: trailing spaces

(trailing-spaces)


[error] 299-299: trailing spaces

(trailing-spaces)


[error] 305-305: trailing spaces

(trailing-spaces)


[error] 308-308: trailing spaces

(trailing-spaces)


[error] 315-315: trailing spaces

(trailing-spaces)


[error] 320-320: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


[error] 332-332: trailing spaces

(trailing-spaces)


[error] 342-342: trailing spaces

(trailing-spaces)


[error] 358-358: trailing spaces

(trailing-spaces)


[error] 371-371: trailing spaces

(trailing-spaces)


[error] 379-379: trailing spaces

(trailing-spaces)


[error] 385-385: trailing spaces

(trailing-spaces)


[error] 391-391: trailing spaces

(trailing-spaces)


[error] 401-401: trailing spaces

(trailing-spaces)


[error] 413-413: trailing spaces

(trailing-spaces)


[error] 422-422: trailing spaces

(trailing-spaces)


[error] 443-443: trailing spaces

(trailing-spaces)


[error] 461-461: trailing spaces

(trailing-spaces)


[error] 469-469: trailing spaces

(trailing-spaces)


[error] 472-472: trailing spaces

(trailing-spaces)


[error] 493-493: trailing spaces

(trailing-spaces)


[error] 499-499: trailing spaces

(trailing-spaces)


[error] 505-505: trailing spaces

(trailing-spaces)


[error] 570-570: trailing spaces

(trailing-spaces)


[error] 614-614: trailing spaces

(trailing-spaces)


[error] 620-620: trailing spaces

(trailing-spaces)


[error] 626-626: trailing spaces

(trailing-spaces)


[error] 691-691: trailing spaces

(trailing-spaces)


[error] 741-741: trailing spaces

(trailing-spaces)


[error] 801-801: trailing spaces

(trailing-spaces)


[error] 803-803: trailing spaces

(trailing-spaces)


[error] 810-810: trailing spaces

(trailing-spaces)


[error] 854-854: trailing spaces

(trailing-spaces)


[error] 868-868: trailing spaces

(trailing-spaces)

@dohernandez dohernandez force-pushed the chore/nod-189-ci-automate-changelog branch from 49bef72 to 493a9db Compare July 26, 2025 13:06
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: 1

♻️ Duplicate comments (4)
.github/workflows/sync-docs-from-node.yml (4)

148-152: Branch-name sanitisation still too narrow

Only replacing / leaves other illegal or dangerous characters (spaces, unicode, control chars).
Use a whitelist approach to keep [A-Za-z0-9._-] and collapse any invalid run to -.

-          SAFE_VERSION=$(echo "$VERSION" | sed 's/\//-/g')
+          SAFE_VERSION=$(echo "$VERSION" | tr -c 'A-Za-z0-9._-' '-' | sed 's/^-*//;s/-*$//;s/-\{2,\}/-/g')

67-74: Treat the literal string "null" the same as an empty value when defaulting VERSION

The earlier review already highlighted that ${{ github.event.client_payload.version }} expands to the string null when the key is missing.
The current guard still only checks for an empty string, so a value of null slips through and later becomes an invalid Git ref, breaking git checkout.

-            VERSION="${{ github.event.client_payload.version }}"
-            if [ -z "$VERSION" ]; then
-              VERSION="latest"
-            fi
-            echo "version=$VERSION" >> $GITHUB_OUTPUT
+            raw_version='${{ github.event.client_payload.version }}'
+# Treat empty or "null" as unset
+            if [ -z "$raw_version" ] || [ "$raw_version" = "null" ]; then
+              VERSION="latest"
+            else
+              VERSION="$raw_version"
+            fi
+            echo "version=$VERSION" >> $GITHUB_OUTPUT

92-93: token: ${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }} will hard-fail if the first secret is undefined

GitHub Actions refuses to reference an unset secret – the entire job errors out before runtime evaluation.
Remove the inline fallback and instead guarantee that NODE_REPO_TOKEN is always populated (e.g. set it to the value of GITHUB_TOKEN at repo level) or fall back at runtime inside the script.

-          token: ${{ secrets.NODE_REPO_TOKEN || secrets.GITHUB_TOKEN }}
+          token: ${{ secrets.NODE_REPO_TOKEN }}

778-785: git add aborts when any listed path is missing

If, for example, pages/validators does not exist in this run, the whole job fails.
Either add paths conditionally or simply stage all modifications.

-          git add content/validators pages/api-references pages/validators
+          git add -A
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 49bef72 and 1e91472.

📒 Files selected for processing (1)
  • .github/workflows/sync-docs-from-node.yml (19 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version references in download examples and version lists in setup-guide.mdx when new validator releases occur
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Use consistent format for changelog entries in changelog.mdx
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/changelog.mdx : Changelog Updates (pages/validators/changelog.mdx): Add new version entries at the top in reverse chronological order, use consistent format: # v0.x.x, ## New features, ## Bug fixes, ## Misc, and include missing intermediate versions if needed
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update configuration examples with new contract addresses in setup-guide.mdx when applicable
.github/workflows/sync-docs-from-node.yml (7)

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Update version list in curl command output example (line ~88), download command version variable (line ~113), consensus contract addresses and genesis block number (lines ~143-146), and command documentation (line ~347) in setup-guide.mdx for new validator releases

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in 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-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Enhance command documentation in setup-guide.mdx when new features are added to existing commands

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable and will result in an empty string. To capture workflow run timestamps, use a shell command like date -u +"%Y-%m-%dT%H:%M:%SZ" in a step and reference it via step outputs.

Learnt from: dohernandez
PR: #245
File: .github/workflows/sync-docs-from-node.yml:451-462
Timestamp: 2025-07-14T09:41:24.667Z
Learning: In GitHub Actions workflows, github.run_started_at is not a valid context variable. The only timestamp available is github.event.workflow_run.run_started_at, which is only available for workflows triggered by workflow_run events. For other event types like repository_dispatch and workflow_dispatch, use shell commands like date -u to capture timestamps.

Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to scripts/generate-full-docs.js : Build process includes automatic generation of full documentation concatenation (scripts/generate-full-docs.js) and sitemap generation (scripts/generate-sitemap-xml.js)

🪛 YAMLlint (1.37.1)
.github/workflows/sync-docs-from-node.yml

[error] 51-51: trailing spaces

(trailing-spaces)


[error] 107-107: trailing spaces

(trailing-spaces)


[error] 112-112: trailing spaces

(trailing-spaces)


[error] 131-131: trailing spaces

(trailing-spaces)


[error] 151-151: trailing spaces

(trailing-spaces)


[error] 157-157: trailing spaces

(trailing-spaces)


[error] 249-249: trailing spaces

(trailing-spaces)


[error] 255-255: trailing spaces

(trailing-spaces)


[error] 270-270: trailing spaces

(trailing-spaces)


[error] 275-275: trailing spaces

(trailing-spaces)


[error] 281-281: trailing spaces

(trailing-spaces)


[error] 284-284: trailing spaces

(trailing-spaces)


[error] 291-291: trailing spaces

(trailing-spaces)


[error] 296-296: trailing spaces

(trailing-spaces)


[error] 303-303: trailing spaces

(trailing-spaces)


[error] 308-308: trailing spaces

(trailing-spaces)


[error] 318-318: trailing spaces

(trailing-spaces)


[error] 334-334: trailing spaces

(trailing-spaces)


[error] 347-347: trailing spaces

(trailing-spaces)


[error] 355-355: trailing spaces

(trailing-spaces)


[error] 361-361: trailing spaces

(trailing-spaces)


[error] 367-367: trailing spaces

(trailing-spaces)


[error] 377-377: trailing spaces

(trailing-spaces)


[error] 389-389: trailing spaces

(trailing-spaces)


[error] 398-398: trailing spaces

(trailing-spaces)


[error] 419-419: trailing spaces

(trailing-spaces)


[error] 437-437: trailing spaces

(trailing-spaces)


[error] 445-445: trailing spaces

(trailing-spaces)


[error] 448-448: trailing spaces

(trailing-spaces)


[error] 469-469: trailing spaces

(trailing-spaces)


[error] 475-475: trailing spaces

(trailing-spaces)


[error] 481-481: trailing spaces

(trailing-spaces)


[error] 546-546: trailing spaces

(trailing-spaces)


[error] 590-590: trailing spaces

(trailing-spaces)


[error] 596-596: trailing spaces

(trailing-spaces)


[error] 602-602: trailing spaces

(trailing-spaces)


[error] 667-667: trailing spaces

(trailing-spaces)


[error] 717-717: trailing spaces

(trailing-spaces)


[error] 777-777: trailing spaces

(trailing-spaces)


[error] 779-779: trailing spaces

(trailing-spaces)


[error] 786-786: trailing spaces

(trailing-spaces)


[error] 830-830: trailing spaces

(trailing-spaces)


[error] 844-844: trailing spaces

(trailing-spaces)

Comment on lines +470 to +485
# Function to check if filename matches the regex pattern
# Uses perl if available for PCRE support, otherwise falls back to grep -E
matches_pattern() {
local filename="$1"
local pattern="$2"

# Try perl first (supports PCRE including negative lookahead)
if command -v perl >/dev/null 2>&1; then
echo "$filename" | perl -ne "exit 0 if /^($pattern)\$/; exit 1"
return $?
fi

# Fallback to grep -E (doesn't support negative lookahead)
echo "$filename" | grep -E "^($pattern)$" >/dev/null 2>&1
return $?
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

matches_pattern is vulnerable to regex & quote injection

$pattern is expanded inside a double-quoted Perl one-liner without any escaping.
A crafted pattern containing / or " will break the command and could even execute unintended code inside the shell.

Minimal safe fix:

-              echo "$filename" | perl -ne "exit 0 if /^($pattern)\$/; exit 1"
+              perl -e '
+                my ($file, $re) = @ARGV;
+                exit(($file =~ /^${re}$/) ? 0 : 1);
+              ' -- "$filename" "$pattern"

Or escape the pattern before embedding.

[security]

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Function to check if filename matches the regex pattern
# Uses perl if available for PCRE support, otherwise falls back to grep -E
matches_pattern() {
local filename="$1"
local pattern="$2"
# Try perl first (supports PCRE including negative lookahead)
if command -v perl >/dev/null 2>&1; then
echo "$filename" | perl -ne "exit 0 if /^($pattern)\$/; exit 1"
return $?
fi
# Fallback to grep -E (doesn't support negative lookahead)
echo "$filename" | grep -E "^($pattern)$" >/dev/null 2>&1
return $?
}
# Function to check if filename matches the regex pattern
# Uses perl if available for PCRE support, otherwise falls back to grep -E
matches_pattern() {
local filename="$1"
local pattern="$2"
# Try perl first (supports PCRE including negative lookahead)
if command -v perl >/dev/null 2>&1; then
perl -e '
my ($file, $re) = @ARGV;
exit(($file =~ /^${re}$/) ? 0 : 1);
' -- "$filename" "$pattern"
return $?
fi
# Fallback to grep -E (doesn't support negative lookahead)
echo "$filename" | grep -E "^($pattern)$" >/dev/null 2>&1
return $?
}
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 475-475: trailing spaces

(trailing-spaces)


[error] 481-481: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/sync-docs-from-node.yml around lines 470 to 485, the
matches_pattern function embeds the $pattern variable directly inside a
double-quoted Perl one-liner, which risks regex and quote injection if $pattern
contains special characters like / or ". To fix this, escape all special
characters in $pattern before embedding it in the Perl command, or alternatively
use a safer method to pass the pattern to Perl without direct interpolation,
ensuring the shell command cannot be broken or exploited.

@dohernandez dohernandez merged commit 3bd9b9f into main Jul 26, 2025
6 checks passed
@dohernandez dohernandez deleted the chore/nod-189-ci-automate-changelog branch July 26, 2025 13:28
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