@devries-cameron20 / composio-1 / commits / b42d3451a
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

ci(docs): rebuild stale KB semantic artifact from the scheduled job

The KB refresh workflow only rebuilt docs/kb/semantic-index.json when the upstream support-knowledge commit moved, but any docs-side text change (guide edits, generator updates) invalidates the artifact record hashes too. The PR-path check:kb-semantic gate then stays red until someone with OPENAI_API_KEY refreshes the artifact by hand, as 0fb5438c3 did. The scheduled job now also detects artifact staleness against the checked-in corpus and rebuilds plus proposes the refresh PR in that case, reusing cached vectors for unchanged records. Setup and install now run unconditionally; the upstream import still runs only when the upstream commit changes.

jkomyno committed Aug 26, 2026 at 10:48 UTC b42d3451a782aa76e74f16fa7b7ff07448eb7e9a
1 file changed +34 -12
.github/workflows/docs-update-kb.yml
+34 -12
@@ -16,7 +16,8 @@ jobs:
16 permissions:
17 contents: read
18 outputs:
19 - changed: ${{ steps.source.outputs.changed }}
19 + changed: ${{ steps.rebuild.outputs.changed }}
20 + upstream_changed: ${{ steps.source.outputs.upstream_changed }}
21 commit: ${{ steps.source.outputs.commit }}
22 defaults:
23 run:
@@ -55,19 +56,17 @@ jobs:
56 current_commit=$(jq -r '.source.commit' kb/manifest.json)
57 echo "commit=$source_commit" >> "$GITHUB_OUTPUT"
58 if [ "$source_commit" = "$current_commit" ]; then
58 - echo "changed=false" >> "$GITHUB_OUTPUT"
59 + echo "upstream_changed=false" >> "$GITHUB_OUTPUT"
60 echo "Support knowledge is already current at $source_commit."
61 else
61 - echo "changed=true" >> "$GITHUB_OUTPUT"
62 + echo "upstream_changed=true" >> "$GITHUB_OUTPUT"
63 echo "Refreshing support knowledge from $current_commit to $source_commit."
64 fi
65
66 - name: Setup Node.js, pnpm, Bun
66 - if: steps.source.outputs.changed == 'true'
67 uses: ./.github/actions/setup-node-pnpm-bun
68
69 - name: Cache Bun dependencies
70 - if: steps.source.outputs.changed == 'true'
70 uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
71 with:
72 path: ~/.bun/install/cache
@@ -76,11 +75,34 @@ jobs:
75 ${{ runner.os }}-bun-
76
77 - name: Install dependencies
79 - if: steps.source.outputs.changed == 'true'
78 run: bun install
79
80 + # Docs-side text changes (generator updates, guide edits) also invalidate
81 + # the checked-in semantic artifact. Detect that here so CI rebuilds the
82 + # artifact even when the upstream support-knowledge commit has not moved.
83 + - name: Detect stale semantic artifact
84 + id: semantic
85 + if: steps.source.outputs.upstream_changed == 'false'
86 + run: |
87 + if bun scripts/build-kb-semantic-index.ts --check; then
88 + echo "stale=false" >> "$GITHUB_OUTPUT"
89 + else
90 + echo "stale=true" >> "$GITHUB_OUTPUT"
91 + echo "Semantic artifact is stale against the checked-in docs corpus."
92 + fi
93 +
94 + - name: Resolve rebuild
95 + id: rebuild
96 + run: |
97 + if [ "${{ steps.source.outputs.upstream_changed }}" = "true" ] || [ "${{ steps.semantic.outputs.stale }}" = "true" ]; then
98 + echo "changed=true" >> "$GITHUB_OUTPUT"
99 + else
100 + echo "changed=false" >> "$GITHUB_OUTPUT"
101 + echo "Support knowledge and semantic artifact are both current."
102 + fi
103 +
104 - name: Import public support knowledge
83 - if: steps.source.outputs.changed == 'true'
105 + if: steps.source.outputs.upstream_changed == 'true'
106 env:
107 SOURCE_ROOT: ${{ github.workspace }}/.support-knowledge
108 SOURCE_COMMIT: ${{ steps.source.outputs.commit }}
@@ -90,19 +112,19 @@ jobs:
112 --source-commit "$SOURCE_COMMIT"
113
114 - name: Rebuild generated pages and semantic artifact
93 - if: steps.source.outputs.changed == 'true'
115 + if: steps.rebuild.outputs.changed == 'true'
116 env:
117 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
118 run: bun run build:kb-semantic
119
120 - name: Verify refreshed knowledge base
99 - if: steps.source.outputs.changed == 'true'
121 + if: steps.rebuild.outputs.changed == 'true'
122 run: |
123 bun run verify:kb
124 bun run check:kb-semantic
125
126 - name: Upload verified KB artifacts
105 - if: steps.source.outputs.changed == 'true'
127 + if: steps.rebuild.outputs.changed == 'true'
128 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
129 with:
130 name: support-knowledge-refresh
@@ -149,9 +171,9 @@ jobs:
171 commit-message: 'docs(kb): refresh public support knowledge'
172 title: 'docs(kb): refresh public support knowledge'
173 body: |
152 - Automated public-only refresh from `ComposioHQ/support-knowledge`.
174 + Automated knowledge-base refresh for `ComposioHQ/support-knowledge`.
175
154 - - Source commit: `${{ needs.refresh.outputs.commit }}`
176 + - Source commit: `${{ needs.refresh.outputs.commit }}` (${{ needs.refresh.outputs.upstream_changed == 'true' && 'imported new support knowledge' || 'unchanged; rebuilt a stale semantic artifact' }})
177 - Regenerated public KB pages and search records
178 - Reused unchanged vectors and rebuilt the checked semantic artifact
179 - Ran KB freshness and semantic-artifact verification