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

Commit 286e4e1

Browse files
author
afterrburn
committed
fix full sync
1 parent 3554f08 commit 286e4e1

1 file changed

Lines changed: 59 additions & 41 deletions

File tree

.github/workflows/sync-docs-full.yml

Lines changed: 59 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,49 +12,67 @@ jobs:
1212
- name: Get all MDX files and prepare payload
1313
id: files
1414
run: |
15-
# Find all MDX files in content directory and store in a file
15+
# First find all MDX files recursively
1616
echo "Finding all MDX files..."
17-
find content -name "*.mdx" | sed 's|^content/||' > mdx_files.txt
18-
echo "Found files:"
19-
cat mdx_files.txt
20-
21-
# Build JSON payload with all files
22-
payload=$(jq -n \
23-
--arg repo "${{ github.repository }}" \
24-
--slurpfile files <(cat mdx_files.txt | jq -R .) \
25-
--slurpfile changed <(
26-
while IFS= read -r f; do
27-
if [ -f "content/$f" ]; then
28-
echo "Processing file: content/$f"
29-
jq -n \
30-
--arg path "$f" \
31-
--arg content "$(base64 -w0 < "content/$f")" \
32-
'{path: $path, content: $content}'
33-
fi
34-
done < mdx_files.txt | jq -s '.'
35-
) \
36-
'{
37-
repo: $repo,
38-
removed: $files,
39-
changed: ($changed | .[0] // [])
40-
}'
41-
)
42-
43-
# Save payload to file to avoid GitHub Actions output issues
44-
echo "$payload" > payload.json
45-
46-
# Set the payload path as output
47-
echo "payload_path=payload.json" >> $GITHUB_OUTPUT
17+
ALL_PATHS=$(find content -type f -name "*.mdx" | sed 's|^content/||')
18+
19+
# Debug - show all found paths
20+
echo "Found these MDX files:"
21+
echo "$ALL_PATHS"
22+
23+
# Create JSON arrays for both changed and removed
24+
# We want to remove and re-add everything to get a fresh start
25+
CHANGED_JSON="["
26+
REMOVED_JSON="["
27+
FIRST_CHANGED=true
28+
FIRST_REMOVED=true
29+
30+
while IFS= read -r path; do
31+
# Skip empty lines
32+
[ -z "$path" ] && continue
33+
34+
# Add to removed array (all paths)
35+
if [ "$FIRST_REMOVED" = true ]; then
36+
FIRST_REMOVED=false
37+
REMOVED_JSON+="\"$path\""
38+
else
39+
REMOVED_JSON+=",\"$path\""
40+
fi
41+
42+
# Add to changed array (with content)
43+
if [ -f "content/$path" ]; then
44+
CONTENT=$(base64 -w0 < "content/$path")
45+
if [ "$FIRST_CHANGED" = true ]; then
46+
FIRST_CHANGED=false
47+
CHANGED_JSON+="{\"path\":\"$path\",\"content\":\"$CONTENT\"}"
48+
else
49+
CHANGED_JSON+=",{\"path\":\"$path\",\"content\":\"$CONTENT\"}"
50+
fi
51+
fi
52+
done <<< "$ALL_PATHS"
53+
54+
CHANGED_JSON+="]"
55+
REMOVED_JSON+="]"
56+
57+
# Construct the final payload
58+
PAYLOAD="{\"repo\":\"$GITHUB_REPOSITORY\",\"changed\":$CHANGED_JSON,\"removed\":$REMOVED_JSON}"
59+
60+
# Debug - show what we're about to send
61+
echo "Payload structure (without file contents):"
62+
echo "$PAYLOAD" | jq 'del(.changed[].content)'
63+
64+
# Save full payload to file
65+
echo "$PAYLOAD" > payload.json
4866
49-
- name: Show debug info
67+
- name: Send to Agentuity
5068
run: |
51-
echo "Files to process:"
69+
echo "About to sync these files:"
5270
jq -r '.changed[].path' payload.json
53-
echo -e "\nFiles to remove first:"
71+
echo -e "\nWill first remove these paths:"
5472
jq -r '.removed[]' payload.json
55-
echo -e "\nFull payload:"
56-
cat payload.json
57-
# curl https://agentuity.ai/webhook/f61d5ce9d6ed85695cc992c55ccdc2a6 \
58-
# -X POST \
59-
# -H "Content-Type: application/json" \
60-
# -d @payload.json
73+
74+
# Uncomment to actually send
75+
# curl https://agentuity.ai/webhook/f61d5ce9d6ed85695cc992c55ccdc2a6 \
76+
# -X POST \
77+
# -H "Content-Type: application/json" \
78+
# -d @payload.json

0 commit comments

Comments
 (0)