Skip to content

CI build documentation automatically#120

Merged
mvdoc merged 9 commits into
mainfrom
fix-gendoc
May 20, 2026
Merged

CI build documentation automatically#120
mvdoc merged 9 commits into
mainfrom
fix-gendoc

Conversation

@kroq-gar78

Copy link
Copy Markdown
Collaborator

This PR adds a new workflow to build documentation and push to GitHub Pages on tagged commits. (Fixes #104.)

It also replaces the previous key scrubbing script to avoid leaking keys in the Actions logs (gendoc/remove_keys.py). I've confirmed locally that it doesn't output any keys.

@kroq-gar78 kroq-gar78 requested a review from Copilot May 19, 2026 23:49

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the external rpl dependency in remove_keys.py with a native Python implementation for sanitizing documentation files, updates version comparison logic to use looseversion, and adds several documentation dependencies to pyproject.toml. Review feedback suggests improving the sanitization script by handling missing configuration keys with fallbacks, restoring case-insensitive replacement to prevent sensitive data exposure, simplifying the should_replace logic, and using safer error handling for file encoding to prevent silent data loss.

Comment thread gendoc/remove_keys.py
Comment thread gendoc/remove_keys.py Outdated
Comment thread gendoc/remove_keys.py Outdated
Comment thread gendoc/remove_keys.py Outdated
def sanitize_file(file_path, replacements):
global files_sanitized, files_changed
try:
with open(file_path, "r", encoding="utf-8", errors="ignore") as handle:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using errors="ignore" when opening files for reading and writing (see also line 51) can lead to silent data loss if the files contain characters that are not valid UTF-8. For a tool that modifies files in-place, it is safer to use errors="replace" to preserve the file structure or to omit the parameter to allow the script to fail loudly if an encoding issue occurs, preventing silent corruption of documentation files.

References
  1. The 'errors' parameter in the open() function is a Python 3 feature that allows for explicit encoding error handling.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem very important, but I did change it anyway. I don't think it has any implications for leaking keys.

@kroq-gar78 kroq-gar78 marked this pull request as draft May 19, 2026 23:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new GitHub Actions workflow that builds Sphinx documentation on every push/PR to main and publishes the built site to the gh-pages branch on tag pushes (addressing issue #104). It also rewrites the doc-key scrubber in pure Python so secrets are no longer echoed into Action logs, and aligns LooseVersion/pip caching with modern packaging.

Changes:

  • Add .github/workflows/build_docs.yml to build docs on push/PR and deploy to gh-pages on tags.
  • Replace the rpl-shelling gendoc/remove_keys.py with a pure-Python walker that does not print secrets, plus an empty-args guard.
  • Switch distutils.version.LooseVersion to the looseversion package, add corresponding docs dependencies, and update the test workflow's pip cache key to pyproject.toml.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.github/workflows/build_docs.yml New workflow building Sphinx docs and conditionally publishing to gh-pages.
.github/workflows/run_tests.yml Update pip cache key from setup.py to pyproject.toml.
pyproject.toml Add looseversion, numpydoc, and sphinx_bootstrap_theme to the docs dependency group.
gendoc/tools/build_modref_templates.py Switch LooseVersion import to the maintained looseversion package.
gendoc/remove_keys.py Replace rpl-based shell calls with a Python file walker; add empty-args guard and error reporting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/build_docs.yml Outdated
Comment thread .github/workflows/build_docs.yml Outdated
Comment thread gendoc/remove_keys.py Outdated
Comment thread gendoc/remove_keys.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gallantlab/cottoncandy/sessions/9682fb4b-670f-4c5c-ad82-3ec96d1cdead

Co-authored-by: kroq-gar78 <648148+kroq-gar78@users.noreply.github.com>
@kroq-gar78 kroq-gar78 requested a review from mvdoc May 20, 2026 21:23
@kroq-gar78 kroq-gar78 marked this pull request as ready for review May 20, 2026 21:23
Added manual trigger for publishing documentation.
@mvdoc

mvdoc commented May 20, 2026

Copy link
Copy Markdown
Contributor

LGTM. I added an option to build and publish docs manually (it can be helpful). Will merge after CI passes.

@mvdoc mvdoc merged commit d3f5dd1 into main May 20, 2026
9 checks passed
@mvdoc mvdoc deleted the fix-gendoc branch May 20, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamically build website with new versions

4 participants