Skip to content
Merged
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
116 changes: 116 additions & 0 deletions .github/workflows/sync-sdk-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Sync SDK docs from delight-ai-agent

on:
repository_dispatch:
types: [sync-sdk-docs]
workflow_dispatch:

jobs:
sync-sdk-docs:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Checkout delight-ai-docs
uses: actions/checkout@v4
with:
ref: sagan/docs-sync-test
token: ${{ secrets.BOT_TOKEN }}

- name: Checkout delight-ai-agent
uses: actions/checkout@v4
with:
repository: sendbird/delight-ai-agent
ref: sagan/docs-sync-test
path: delight-ai-agent
token: ${{ secrets.BOT_TOKEN }}

- name: Sync mapped files from delight-ai-agent to sdk-docs
run: |
python << 'EOF'
import shutil
from pathlib import Path

agent_root = Path("delight-ai-agent")
docs_root = Path(".")

MAPPING = {
# ANDROID
"android/docs/conversations.md": "sdk-docs/android/features/conversations.md",
"android/docs/launcher.md": "sdk-docs/android/features/launcher.md",
"android/docs/messages.md": "sdk-docs/android/features/messages.md",
"android/MULTILANGUAGE.md": "sdk-docs/android/multi-language-support.md",
"android/README.md": "sdk-docs/android/quickstart-guide-messenger.md",

# IOS
"ios/docs/conversations.md": "sdk-docs/ios/features/conversations.md",
"ios/docs/launcher.md": "sdk-docs/ios/features/launcher.md",
"ios/docs/messages.md": "sdk-docs/ios/features/messages.md",
"ios/MULTILANGUAGE.md": "sdk-docs/ios/multi-language-support.md",
"ios/README.md": "sdk-docs/ios/quickstart-guide-messenger.md",

# JAVASCRIPT CDN
"js/cdn/docs/conversations.md": "sdk-docs/javascript-cdn/features/conversations.md",
"js/cdn/docs/messages.md": "sdk-docs/javascript-cdn/features/messages.md",
"js/cdn/MULTILANGUAGE.md": "sdk-docs/javascript-cdn/multi-language-support.md",
"js/cdn/README.md": "sdk-docs/javascript-cdn/quickstart-guide-messenger.md",

# REACT (NPM)
"js/react/docs/conversations.md": "sdk-docs/react-npm/features/conversations.md",
"js/react/docs/messages.md": "sdk-docs/react-npm/features/messages.md",
"js/react/MULTILANGUAGE.md": "sdk-docs/react-npm/multi-language-support.md",
"js/react/README.md": "sdk-docs/react-npm/quickstart-guide-messenger.md",
"js/react/TEMPLATE-LAYOUT-CUSTOMIZATION-GUIDE.md": "sdk-docs/react-npm/template-based-layout-component-customization-guide.md",
}

updated_files = []

for src, dst in MAPPING.items():
src_path = agent_root / src
dst_path = docs_root / dst

if src_path.is_file():
dst_path.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(src_path, dst_path)
updated_files.append(dst)
print(f"Copied {src} -> {dst}")
else:
print(f"[WARN] Missing source: {src}")

if not updated_files:
print("No updates detected.")
EOF

- name: Create pull request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: "chore: sync SDK docs from delight-ai-agent"
title: "chore: sync SDK docs from delight-ai-agent"
body: |
Automated sync from **delight-ai-agent → delight-ai-docs**.
base: sagan/docs-sync-test
branch: chore/sync-sdk-docs
branch-suffix: timestamp
labels: |
docs
automated-pr

- name: Approve pull request
if: steps.cpr.outputs.pull-request-number != ''
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.APPROVE_BOT_TOKEN }}
number: ${{ steps.cpr.outputs.pull-request-number }}

# Optional auto-merge (enable if desired)
# - name: Merge PR
# if: steps.cpr.outputs.pull-request-number != ''
# uses: peter-evans/enable-pull-request-automerge@v3
# with:
# token: ${{ secrets.APPROVE_BOT_TOKEN }}
# pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}