haystack/.github/workflows/docusaurus_sync.yml
dependabot[bot] 33b2b83ce8
chore(deps): bump actions/checkout from 4 to 5 (#9709)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-13 09:28:45 +02:00

75 lines
2.1 KiB
YAML

name: Sync docs with Docusaurus
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "docs/pydoc/config_docusaurus/**"
- "haystack/**"
- ".github/workflows/docusaurus_sync.yml"
env:
HATCH_VERSION: "1.14.1"
PYTHON_VERSION: "3.9"
DOCS_REPO: "deepset-ai/haystack-docs"
DOCS_REPO_PATH: "reference/haystack-api"
jobs:
sync:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Haystack repo
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}
- name: Generate API docs for Docusaurus
# This command simply runs ./.github/utils/pydoc-markdown.sh with a specific config path
run: hatch run readme:sync "../config_docusaurus/*"
- name: Checkout Docusaurus repo
uses: actions/checkout@v5
with:
repository: ${{ env.DOCS_REPO }}
token: ${{ secrets.HAYSTACK_BOT_TOKEN }}
path: haystack-docs
- name: Sync generated docs to Docusaurus repo
run: |
SOURCE_PATH="docs/pydoc/temp"
DEST_PATH="haystack-docs/${{ env.DOCS_REPO_PATH }}"
echo "Syncing from $SOURCE_PATH to $DEST_PATH"
mkdir -p $DEST_PATH
# Using rsync to copy files. This will also remove files in dest that are no longer in source.
rsync -av --delete --exclude='.git/' "$SOURCE_PATH/" "$DEST_PATH/"
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.HAYSTACK_BOT_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
cd haystack-docs
if [[ -n $(git status -s) ]]; then
echo "Syncing docs with Docusaurus..."
git add .
git commit -m "docs: Sync Haystack API reference"
git push
else
echo "No changes to sync with Docusaurus."
fi