Skip to content

fix: Replace local Python filtering with Elasticsearch query passthro… #67

fix: Replace local Python filtering with Elasticsearch query passthro…

fix: Replace local Python filtering with Elasticsearch query passthro… #67

Workflow file for this run

name: Branch Synchronization
on:
push:
branches: [ main ]
workflow_dispatch:
inputs:
sync_direction:
description: 'Sync direction'
required: true
default: 'main-to-remote'
type: choice
options:
- main-to-remote
- remote-to-main
- bidirectional
jobs:
sync-branches:
name: Sync Branches
runs-on: ubuntu-latest
if: github.repository_owner == 'gensecaihq'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Git
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
- name: Fetch all branches
run: |
git fetch origin
- name: Check branch existence
id: branches
run: |
if git ls-remote --exit-code --heads origin mcp-remote >/dev/null 2>&1; then
echo "mcp_remote_exists=true" >> $GITHUB_OUTPUT
git checkout -b mcp-remote origin/mcp-remote
git checkout main
else
echo "mcp_remote_exists=false" >> $GITHUB_OUTPUT
echo "::notice::mcp-remote branch does not exist yet"
fi
- name: Check for version management tools
run: |
if [ -f tools/branch-sync.py ]; then
echo "Version management tools found"
python3 tools/branch-sync.py status
else
echo "Version management tools not found"
fi
- name: Create sync report
run: |
echo "# Branch Sync Report" >> $GITHUB_STEP_SUMMARY
echo "## Current Status" >> $GITHUB_STEP_SUMMARY
echo "- Main branch: $(git rev-parse --short HEAD)" >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.branches.outputs.mcp_remote_exists }}" == "true" ]; then
echo "- MCP-Remote branch: $(git rev-parse --short origin/mcp-remote)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Differences" >> $GITHUB_STEP_SUMMARY
echo "### Main → MCP-Remote" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
git log HEAD..origin/mcp-remote --oneline | head -10 >> $GITHUB_STEP_SUMMARY || echo "No differences" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "### MCP-Remote → Main" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
git log origin/mcp-remote..HEAD --oneline | head -10 >> $GITHUB_STEP_SUMMARY || echo "No differences" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
else
echo "- MCP-Remote branch: **does not exist**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "> **Note:** Create the mcp-remote branch when ready to support MCP remote transport mode." >> $GITHUB_STEP_SUMMARY
fi
- name: Sync based on input
if: github.event_name == 'workflow_dispatch' && steps.branches.outputs.mcp_remote_exists == 'true'
run: |
case "${{ github.event.inputs.sync_direction }}" in
main-to-remote)
echo "Syncing main → mcp-remote (shared components only)"
# Cherry-pick specific commits or merge shared components
;;
remote-to-main)
echo "Syncing mcp-remote → main (STDIO-compatible changes only)"
# Cherry-pick STDIO-compatible changes
;;
bidirectional)
echo "Bidirectional sync (careful merge)"
# Merge compatible changes both ways
;;
esac
- name: Version check
run: |
echo "## Version Information" >> $GITHUB_STEP_SUMMARY
echo "### Main Branch" >> $GITHUB_STEP_SUMMARY
if [ -f pyproject.toml ]; then
echo "Version: $(grep '^version' pyproject.toml | cut -d'"' -f2)" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ steps.branches.outputs.mcp_remote_exists }}" == "true" ]; then
echo "### MCP-Remote Branch" >> $GITHUB_STEP_SUMMARY
git checkout mcp-remote
if [ -f pyproject.toml ]; then
echo "Version: $(grep '^version' pyproject.toml | cut -d'"' -f2)" >> $GITHUB_STEP_SUMMARY
fi
fi