Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions .github/workflows/sync-agent-sdk-openapi.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Sync agent-sdk OpenAPI

on:
push:
branches:
- '**' # run on every branch
schedule:
- cron: '0 2 * * *' # nightly catch-up
workflow_dispatch:
Expand All @@ -15,12 +12,11 @@ on:

permissions:
contents: write
pull-requests: write

jobs:
sync-openapi:
runs-on: ubuntu-latest
# Avoid infinite loops on our own commits
if: github.actor != 'github-actions[bot]'

env:
# GITHUB_TOKEN is fine.
Expand All @@ -32,6 +28,7 @@ jobs:
- name: Checkout docs repo
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
persist-credentials: true

Expand Down Expand Up @@ -72,19 +69,21 @@ jobs:
echo "changes=false" >> "$GITHUB_OUTPUT"
fi

- name: Commit and push OpenAPI spec
- name: Create Pull Request with OpenAPI changes
if: steps.detect_changes.outputs.changes == 'true'
run: |
set -euo pipefail
git add openapi/agent-sdk.json
# Re-check in case only unrelated files changed
if git diff --cached --quiet; then
echo "No OpenAPI changes to commit."
exit 0
fi
uses: peter-evans/create-pull-request@v7
with:
commit-message: |
docs(sync-openapi): agent-sdk ${{ env.AGENT_SDK_REF }}

SHA_SHORT="$(git -C agent-sdk rev-parse --short=7 HEAD || echo manual)"
BRANCH="${AGENT_SDK_REF:-main}"
Generated from agent-sdk at `${{ env.AGENT_SDK_REF }}`.
title: "chore(docs): sync agent-sdk OpenAPI"
body: |
This PR was automatically created by the nightly sync workflow.

git commit -m "sync(openapi): agent-sdk/${BRANCH} ${SHA_SHORT}"
git push
It updates the OpenAPI spec to match OpenHands/agent-sdk at `${{ env.AGENT_SDK_REF }}`.
branch: chore/sync-openapi
delete-branch: true
signoff: false
add-paths: |
openapi/agent-sdk.json
35 changes: 19 additions & 16 deletions .github/workflows/sync-docs-code-blocks.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Sync Documentation Code Blocks

on:
push:
branches:
- '**' # run on every branch
schedule:
# Run daily at 2 AM UTC to catch any changes
- cron: '0 2 * * *'
Expand All @@ -21,11 +18,11 @@ permissions:
jobs:
sync-code-blocks:
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]'
steps:
- name: Checkout docs repository
- name: Checkout docs repository (main)
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0

- name: Checkout agent-sdk
Expand Down Expand Up @@ -55,15 +52,21 @@ jobs:
echo "changes=false" >> "$GITHUB_OUTPUT"
fi

- name: Commit and push changes
if: steps.detect_changes.outputs.changes == 'true' # <-- updated reference
shell: bash
run: |
set -euo pipefail
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "docs: sync code blocks from agent-sdk examples
- name: Create Pull Request with synced changes
if: steps.detect_changes.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v7
with:
commit-message: |
docs(sync): code blocks from agent-sdk

Synced from agent-sdk ref: ${{ github.event.inputs.agent_sdk_ref || 'main' }}
title: "chore(docs): sync code blocks from agent-sdk"
body: |
This PR was automatically created by the nightly sync workflow.

It updates SDK guide code blocks to match the source examples in OpenHands/agent-sdk at `${{ github.event.inputs.agent_sdk_ref || 'main' }}`.

Synced from agent-sdk ref: ${{ github.event.inputs.agent_sdk_ref || 'main' }}"
git push
If additional changes are included, please review them carefully.
branch: chore/sync-docs-code-blocks
delete-branch: true
signoff: false
4 changes: 2 additions & 2 deletions .openhands/microagents/sdk-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ You can check https://www.mintlify.com/docs for documentation on what our doc si

### Code Synchronization Workflow
- **File**: `.github/workflows/sync-docs-code-blocks.yml`
- **Triggers**: Push to any branch, daily at 2 AM UTC, manual dispatch
- **Triggers**: Nightly at 2 AM UTC and manual dispatch
- **Purpose**: Keeps code blocks in sync with agent-sdk examples
- **Actions**: Checks out both repositories, runs sync script, commits changes if needed
- **Actions**: Checks out both repositories, runs sync script, and opens a dedicated PR if changes are found (does not modify unrelated PR branches)

### OpenAPI Sync Workflow
- **File**: `.github/workflows/sync-agent-sdk-openapi.yml`
Expand Down