Skip to content

Commit

Permalink
CI: sync API docs with readme.com (#266)
Browse files Browse the repository at this point in the history
* first draft

test commit, to be reverted

Revert "test commit, to be reverted"

This reverts commit b9997f7.

* test commit, to be reverted

fine tune action settings

try

try

try

try

* backup

* revert

* test commit

* install hatch

* test commit

* uniform workflow name

* skip step if nothing changed

* sync with readme

* revert

* final touches

* Update .github/workflows/CI_readme_sync.yml

Co-authored-by: Madeesh Kannan <[email protected]>

* test workflow, revert before merge

* revert script optimization

* Revert "test workflow, revert before merge"

This reverts commit 3538b01.

* test

* reintroduce optimization

* to be reverted

* revert

* try

* test

* test

* Update CI_readme_sync.yml

---------

Co-authored-by: Madeesh Kannan <[email protected]>
  • Loading branch information
masci and shadeMe authored Feb 9, 2024
1 parent 3772369 commit e49d52d
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/CI_readme_sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Core / Sync docs with Readme

on:
push:
branches:
- main

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
with:
# This will tell tj-actions/changed-files to compare the current pushed commit with the latest in main
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U haystack-pydoc-tools hatch
# We look into the changeset in order to understand
# which integrations were modified by the last commit.
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
files: integrations/**
# Output unique changed directories instead of filenames
dir_names: true
# We only care about the name of the integration, i.e. integrations/FOO
dir_names_max_depth: 2

- name: Generate docs
if: steps.changed-files.outputs.all_changed_files != ''
env:
# This is necessary to fetch the documentation categories
# from Readme.io as we need them to associate the slug
# in config files with their id.
README_API_KEY: ${{ secrets.README_API_KEY }}
ALL_CHANGED_DIRS: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for d in $ALL_CHANGED_DIRS; do
cd $d
hatch run docs
cd -
done
mkdir tmp
find . -name "_readme_*.md" -exec cp "{}" tmp \;
ls tmp
- name: Sync preview docs with 2.0
if: steps.changed-files.outputs.all_changed_files != ''
uses: readmeio/[email protected]
env:
README_API_KEY: ${{ secrets.README_API_KEY }}
with:
rdme: docs ./tmp --key="$README_API_KEY" --version=2.0

0 comments on commit e49d52d

Please sign in to comment.