Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.

Create document processor #10

Create document processor

Create document processor #10

Workflow file for this run

name: Sync Docs to Vector Store (PR & Push)
on:
push:
pull_request:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed and removed files (last 2 commits on main)
id: files
run: |
git fetch origin main
last2=$(git rev-list --max-count=2 origin/main)
commit_arr=($last2)
if [ "${#commit_arr[@]}" -eq 2 ]; then
base_commit=${commit_arr[1]}
head_commit=${commit_arr[0]}
else
base_commit=${commit_arr[0]}
head_commit=${commit_arr[0]}
fi
echo "Comparing $base_commit..$head_commit on main branch"
# Get changed files (relative to content directory)
CHANGED_FILES=$(git diff --name-only $base_commit $head_commit -- 'content/**/*.mdx' | sed 's|^content/||')
REMOVED_FILES=$(git diff --name-only --diff-filter=D $base_commit $head_commit -- 'content/**/*.mdx' | sed 's|^content/||')
echo "Changed files: $CHANGED_FILES"
echo "Removed files: $REMOVED_FILES"
# Build JSON payload with file contents
payload=$(jq -n \
--arg commit "$head_commit" \
--arg repo "${{ github.repository }}" \
--argjson changed "$(
if [ -n "$CHANGED_FILES" ]; then
for f in $CHANGED_FILES; do
if [ -f "content/$f" ]; then
jq -n \
--arg path "$f" \
--arg content "$(base64 -w0 < "content/$f")" \
'{path: $path, content: $content}'
fi
done | jq -s '.'
else
echo '[]'
fi
)" \
--argjson removed "$(
if [ -n "$REMOVED_FILES" ]; then
printf '%s\n' $REMOVED_FILES | jq -R -s -c 'split("\n") | map(select(length > 0))'
else
echo '[]'
fi
)" \
'{commit: $commit, repo: $repo, changed: $changed, removed: $removed}'
)
echo "payload<<EOF" >> $GITHUB_OUTPUT
echo "$payload" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Trigger Agentuity Sync Agent
run: |
echo "Sending payload to agent:"
echo '${{ steps.files.outputs.payload }}' | jq '.'
curl https://agentuity.ai/webhook/f61d5ce9d6ed85695cc992c55ccdc2a6 \
-X POST \
-H "Content-Type: application/json" \
-d '${{ steps.files.outputs.payload }}'