Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API docs #1511

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/update_api_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Update API docs

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

jobs:
update_api:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
working-directory: ./docs/api_docs
steps:
- name: Check out repository 🛎️
uses: actions/checkout@v3

- name: Install conda dependencies
uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10"
activate-environment: qhub-dev
environment-file: environment-dev.yaml
auto-activate-base: true

- name: Install nebari and docs dependencies
run: pip install -e ".[docs]"

- name: Conda list
run: conda list

- name: Look for changes to cli files
uses: tj-actions/verify-changed-files@v12
id: verify-changed-files
with:
files: |
qhub/cli/*

- name: Run step only when files change.
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
echo "Changed files: ${{ steps.verify-changed-files.outputs.changed_files }}"
# Outputs: "Changed files: new.txt test_directory/new.txt"

- name: Generate new API docs
run: |
# cd docs/api_docs/
# generate the new docs
pydoc-markdown -I "../../" -p qhub --render-toc > api_temp.md
# make modifications to clean up
python api_doc_mods.py --autogen_path api_temp.md --outpath api_doc.md

- name: Check for changes
run: |
if git diff --exit-code; then
echo "::set-env name=changes_exist::true"
else
echo "::set-env name=changes_exist::false"
fi

- name: Create Pull Request in code repo
id: cpr
uses: peter-evans/create-pull-request@v4
if: ${{ env.changes_exist == 'true' }}
with:
token: ${{ secrets.NEBARI_SENSEI_API_DOCS_PR_OPENER }}
commit-message: Update report
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: auto_api_doc_update
delete-branch: true
title: '[AUTO] Update API doc'
body: |
Update API doc
- Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request
labels: |
"area: documentation 📖"
draft: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# docs
.nox
_build
docs/api_docs/api_temp.md

# setuptools scm
nebari/_version.py
Expand Down
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ yarn-error.log*

app/__pycache__
docs/users.pdf

# docs
docs/api_docs/api_temp.md
24 changes: 24 additions & 0 deletions docs/api_docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Nebari API docs

The Nebari API docs are generated from this repo, then merged into the nebari-docs repo via PR opened by GitHub Actions.

## Environment

```bash
pip install -e ".[docs]"
```

## Workflow

The docs may be built manually through the following workflow, or executed as part of an autoupdate via GH Actions CI.

```bash

git clone git@github.com:nebari-dev/nebari-docs.git

cd docs/api_docs/

pydoc-markdown -I "../../" -p qhub --render-toc > api_temp.md

python api_doc_mods.py --autogen_path api_temp.md --outpath ../../nebari-docs/docs/docs/references/api_docs.md
```
Loading