Skip to content

Commit 69e33c8

Browse files
committed
save file
1 parent a945701 commit 69e33c8

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

.github/workflows/CI_check_api_ref.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,40 +77,34 @@ jobs:
7777
working-directory: integrations/${{ matrix.integration }}
7878
run: |
7979
hatch run docs
80-
# save the generated API reference content to a variable
81-
INTEGRATION_API_REFERENCE=$(cat ${{ matrix.integration }}.md)
82-
echo "INTEGRATION_API_REFERENCE=$INTEGRATION_API_REFERENCE" >> "$GITHUB_OUTPUT"
80+
# Save the generated file before the Haystack checkout overwrites the working tree
81+
cp ${{ matrix.integration }}.md "${{ runner.temp }}/${{ matrix.integration }}.md"
8382
8483
- name: Checkout Haystack repo
8584
uses: actions/checkout@v6
8685
with:
8786
repository: deepset-ai/haystack
8887
ref: main
89-
88+
9089
- name: Sync API reference
9190
shell: python
9291
env:
93-
INTEGRATION_API_REFERENCE_FILENAME: ${{ matrix.integration }}.md
92+
INTEGRATION_API_REFERENCE: ${{ runner.temp }}/${{ matrix.integration }}.md
9493
run: |
9594
import os
9695
import shutil
9796
98-
integration_api_reference = os.environ['INTEGRATION_API_REFERENCE']
99-
integration_api_reference_filename = os.environ['INTEGRATION_API_REFERENCE_FILENAME']
100-
with open(integration_api_reference_filename, 'w') as f:
101-
f.write(integration_api_reference)
97+
api_ref_file = os.environ['INTEGRATION_API_REFERENCE']
10298
10399
# Copy to main API reference
104-
shutil.copy(integration_api_reference, "docs-website/reference/integrations-api/")
100+
shutil.copy(api_ref_file, "docs-website/reference/integrations-api/")
105101
106102
# Copy to versioned API reference
107103
for version_dir in os.scandir("docs-website/reference_versioned_docs"):
108104
if version_dir.is_dir():
109105
# example: docs-website/reference_versioned_docs/version-2.17/integrations-api
110106
integrations_api_ref_dir = os.path.join(version_dir.path, "integrations-api")
111-
shutil.copy(integration_api_reference, integrations_api_ref_dir)
112-
113-
os.remove(integration_api_reference_filename)
107+
shutil.copy(api_ref_file, integrations_api_ref_dir)
114108
115109
- name: Print git status on docs
116110
working-directory: docs-website

0 commit comments

Comments
 (0)