@@ -13,21 +13,15 @@ jobs:
1313 integrations : ${{ steps.changed.outputs.integrations }}
1414 steps :
1515 - uses : actions/checkout@v6
16-
17- - uses : dorny/paths-filter@v3
18- id : changes
1916 with :
20- list-files : json
21- filters : |
22- integrations:
23- - "integrations/**/*.py"
24- - "integrations/**/config_docusaurus.yml"
17+ fetch-depth : 0
2518
2619 - name : Extract changed integrations
2720 id : changed
2821 run : |
29- CHANGED=$(echo '${{ steps.changes.outputs.integrations_files }}' \
30- | jq -c '[.[] | split("/")[1]] | unique')
22+ CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }}...HEAD \
23+ -- 'integrations/**/*.py' 'integrations/**/config_docusaurus.yml' \
24+ | cut -d/ -f2 | sort -u | jq -Rc . | jq -sc .)
3125 echo "integrations=$CHANGED" >> "$GITHUB_OUTPUT"
3226
3327 generate-docs :
@@ -43,12 +37,12 @@ jobs:
4337 with :
4438 fetch-depth : 0
4539
46- - name : Set up Python 3.12
40+ - name : Set up Python 3.13
4741 uses : actions/setup-python@v6
4842 with :
49- python-version : " 3.12 "
43+ python-version : " 3.13 "
5044
51- - name : Check for config changes
45+ - name : Check for Pydoc config changes
5246 id : config
5347 run : |
5448 if git diff --name-only ${{ github.event.pull_request.base.sha }}...HEAD -- "integrations/${{ matrix.integration }}/pydoc/config_docusaurus.yml" | grep -q .; then
@@ -61,27 +55,56 @@ jobs:
6155 if : steps.config.outputs.changed != 'true'
6256 id : docstrings
6357 run : |
64- cp .github/utils/docstrings_checksum.py "${{ runner.temp }}/docstrings_checksum.py"
65- HEAD=$(python "${{ runner.temp }}/docstrings_checksum.py" --root . --integration ${{ matrix.integration }})
66- if git checkout ${{ github.event.pull_request.base.sha }} -- "integrations/${{ matrix.integration }}" 2>/dev/null; then
67- BASE=$(python "${{ runner.temp }}/docstrings_checksum.py" --root . --integration ${{ matrix.integration }})
68- git checkout HEAD -- "integrations/${{ matrix.integration }}"
58+ # Compute docstring checksum for the PR version
59+ PR_DOCSTRINGS_CHECKSUM=$(python .github/utils/docstrings_checksum.py --root . --integration ${{ matrix.integration }})
60+
61+ # Create a temporary worktree at the base SHA to compute the base checksum
62+ if git worktree add "${{ runner.temp }}/base" ${{ github.event.pull_request.base.sha }} 2>/dev/null; then
63+ BASE_DOCSTRINGS_CHECKSUM=$(python .github/utils/docstrings_checksum.py --root "${{ runner.temp }}/base" --integration ${{ matrix.integration }})
64+ git worktree remove "${{ runner.temp }}/base"
6965 else
70- BASE=""
66+ # Integration doesn't exist on the base branch (new integration)
67+ BASE_DOCSTRINGS_CHECKSUM=""
7168 fi
72- echo "changed=$([[ "$BASE" != "$HEAD" ]] && echo true || echo false)" >> "$GITHUB_OUTPUT"
73-
74- # - name: Add documentation label
75- # if: steps.docstrings.outputs.changed == 'true'
76- # env:
77- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78- # run: gh pr edit ${{ github.event.pull_request.number }} --add-label "type:documentation"
69+ echo "changed=$([[ "$BASE_DOCSTRINGS_CHECKSUM" != "$PR_DOCSTRINGS_CHECKSUM" ]] && echo true || echo false)" >> "$GITHUB_OUTPUT"
7970
8071 - name : Install Hatch
8172 if : steps.config.outputs.changed == 'true' || steps.docstrings.outputs.changed == 'true'
8273 run : pip install --upgrade hatch
8374
84- - name : Generate docs
75+ - name : Generate API reference
8576 if : steps.config.outputs.changed == 'true' || steps.docstrings.outputs.changed == 'true'
8677 working-directory : integrations/${{ matrix.integration }}
8778 run : hatch run docs
79+
80+ - name : Checkout Haystack repo
81+ uses : actions/checkout@v6
82+ with :
83+ repository : deepset-ai/haystack
84+ ref : main
85+
86+ - name : Sync API reference
87+ shell : python
88+ env :
89+ INTEGRATION_API_REFERENCE : integrations/${{ matrix.integration }}/${{ matrix.integration }}.md
90+ run : |
91+ import os
92+ import shutil
93+
94+ integration_api_reference = os.environ['INTEGRATION_API_REFERENCE']
95+
96+ # Copy to main API reference
97+ shutil.copy(integration_api_reference, "docs-website/reference/integrations-api/")
98+
99+ # Copy to versioned API reference
100+ for version_dir in os.scandir("docs-website/reference_versioned_docs"):
101+ if version_dir.is_dir():
102+ # example: docs-website/reference_versioned_docs/version-2.17/integrations-api
103+ integrations_api_ref_dir = os.path.join(version_dir.path, "integrations-api")
104+ shutil.copy(integration_api_reference, integrations_api_ref_dir)
105+
106+ # os.remove(artifact_filename)
107+
108+ - name : Print git status on docs
109+ working-directory : docs-website
110+ run : git status
0 commit comments