Skip to content

Conversation

@xingyaoww
Copy link
Contributor

@xingyaoww xingyaoww commented Nov 6, 2025

  • I have read and reviewed the documentation changes to the best of my ability.
  • If the change is significant, I have run the documentation site locally and confirmed it renders as expected.

Summary of changes

Problem

The pr-review.mdx file had an empty YAML code block that wasn't rendering properly. Investigation revealed that the auto-sync script (/docs/.github/scripts/sync_code_blocks.py) only supported Python files (.py), not YAML files (.yml).

Solution

Extended the sync script to support YAML files:

  1. Updated sync_code_blocks.py:

    • Modified extract_code_blocks() to detect both Python and YAML code blocks
    • Pattern matching now handles:
      • Python: ```python ... examples/path/file.py
      • YAML: ```yaml ... examples/path/file.yml
    • Updated function signatures to include language parameter
    • Made code block reconstruction language-aware
  2. Restored pr-review.mdx:

    • Added back the YAML code block with correct path: examples/03_github_workflows/02_pr_review/workflow.yml
    • Ran sync script to populate with actual workflow content (114 lines)
    • Code block now displays the full GitHub Actions workflow

Testing

  • ✅ Verified sync script works with existing Python files (all in sync)
  • ✅ Verified YAML sync successfully populates pr-review.mdx
  • ✅ No breaking changes to existing functionality
  • ✅ Script now supports both .yml and .yaml extensions

Impact

This enables auto-syncing of GitHub workflow examples and other YAML configuration files throughout the documentation, ensuring they stay up-to-date with the source repository.

Remove unsupported auto-sync code block for workflow.yml file.
The sync script only supports Python files, not YAML files.
The workflow file is already properly linked in the Related Files section.

Co-authored-by: openhands <[email protected]>
…orkflow

- Extended sync_code_blocks.py to support both Python (.py) and YAML (.yml/.yaml) files
- Updated extract_code_blocks() to handle multiple file types with language detection
- Modified update_doc_file() to preserve language-specific code block formatting
- Restored and populated YAML code block in pr-review.mdx with workflow content
- All existing Python code blocks remain fully functional

Co-authored-by: openhands <[email protected]>
@xingyaoww xingyaoww changed the title Fix empty workflow code block in pr-review.mdx Add YAML file support to sync_code_blocks.py Nov 6, 2025
@xingyaoww xingyaoww marked this pull request as ready for review November 7, 2025 17:16
- name: Install OpenHands dependencies
run: |
# Install OpenHands SDK and tools from git repository
uv pip install --system "openhands-sdk @ git+https://github.com/OpenHands/agent-sdk.git@main#subdirectory=openhands-sdk"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we say 1.0.0 ? 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or install from pypi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually the example workflow in the SDK repo, not this repo.

cc @simonrosenberg - maybe we do want to point it to latest pypi wheel

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, sure 😅

@enyst
Copy link
Collaborator

enyst commented Nov 7, 2025

@OpenHands What do you think about the PR reviewer workflow requesting "openhands-agent", is there anything else the user needs to do to make it work on their own repos?
/codereview-roasted

@openhands-ai
Copy link

openhands-ai bot commented Nov 7, 2025

I'm on it! enyst can track my progress at all-hands.dev

@openhands-ai
Copy link

openhands-ai bot commented Nov 7, 2025

Summary of my response to the question

  • Requesting “openhands-agent” only works if that GitHub account exists in the target repo and can be requested as a reviewer. Most users won’t have that, so they should either:

    • Use the label trigger (“review-this”), which works universally, or
    • Change the check to a reviewer handle they control and ensure that account is a collaborator/team with access. Better yet, make the reviewer handle configurable (e.g., repo variable/secret).
  • Required setup for users’ repos:

    • Add LLM_API_KEY as a repo secret.
    • Set LLM_MODEL (and LLM_BASE_URL if using a custom gateway), or ensure the script has sensible defaults.
    • The workflow’s permissions (pull-requests: write, issues: write) are correct for posting comments.
  • Forks caveat:

    • For PRs from forks, pull_request workflows have read-only GITHUB_TOKEN and no secrets. If they need to support forks, consider pull_request_target with proper hardening, or keep it as a maintainer-only trigger (label or reviewer request by maintainers).

Recommendation

  • Keep the label trigger as the default path that works everywhere.
  • If a “request reviewer” UX is desired, parameterize the reviewer handle and document that the account must have repo access; optionally support team triggers via requested_team.slug.

View full conversation

…s; recommend label trigger as universal option

Co-authored-by: openhands <[email protected]>
…in OpenHands org repos; advise collaborators/label/use-own-handle for external repos

Co-authored-by: openhands <[email protected]>

<Note>
The reference workflow triggers on either the "review-this" label or when the openhands-agent account is requested as a reviewer. In OpenHands organization repositories, openhands-agent has access, so this works as-is. In your own repositories, requesting openhands-agent will only work if that account is added as a collaborator or is part of a team with access. If you don't plan to grant access, use the label trigger instead, or change the condition to a reviewer handle that exists in your repo.
</Note>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks correct to me (right?), maybe a bit too verbose, but idk, readable.

WDYT, should we keep it? @xingyaoww @simonrosenberg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems useful info to keep?

Copy link
Collaborator

@enyst enyst left a comment

Choose a reason for hiding this comment

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

LGTM, I'm very happy to see openhands-agent documented and working!

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.

4 participants