Skip to content

Automate versioned docs publishing to PyThaiNLP/docs on release#1338

Draft
Copilot wants to merge 3 commits intodevfrom
copilot/automate-docs-build-process
Draft

Automate versioned docs publishing to PyThaiNLP/docs on release#1338
Copilot wants to merge 3 commits intodevfrom
copilot/automate-docs-build-process

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

Documentation for each release was manually copied to PyThaiNLP/docs and the version index had to be hand-updated.

What do these changes do

  • Adds .github/workflows/publish-versioned-docs.yml: triggered on release: published, copies PyThaiNLP/dev-docsPyThaiNLP/docs/{version}/ and updates both index pages
  • Adds build_tools/github/update_docs_index.py: helper script with two modes:
    • --docs-dir: regenerates docs/index.html as a landing page listing all version directories, sorted newest-first
    • --dev-docs-index: injects/updates a <!-- BEGIN VERSIONS -->…<!-- END VERSIONS --> block in dev-docs/index.html; idempotent (no-ops if version already present, appends before </body> if markers are absent)

What was wrong

No automation existed to archive dev docs as a versioned snapshot or maintain the version listing when a release was published.

How this fixes it

On each GitHub release the workflow:

  1. Strips the v prefix from the tag (v5.3.15.3.1)
  2. Syncs dev-docs/ into docs/{version}/ via rsync
  3. Regenerates docs/index.html from the directory listing
  4. Prepends the new version entry to dev-docs/index.html
  5. Commits and pushes both external repos via PERSONAL_TOKEN

The workflow runs only on PyThaiNLP/pythainlp (not forks) and uses permissions: contents: read for the GITHUB_TOKEN.

Your checklist for this pull request

  • Passed code styles and structures
  • Passed code linting checks and unit test
Original prompt

This section details on the original issue you should resolve

<issue_title>Automatic build document to PyThaiNLP/docs when released new version</issue_title>
<issue_description>Now, PyThaiNLP/docs is still want update document by hand when we released new version. I think if github action can automation this step, it will be automation.

Step:

  1. Copy PyThaiNLP/dev_docs to PyThaiNLP/docs and name directory as version (without v).
  2. Update index.html in PyThaiNLP/dev_docs: Move old version and add new version.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: wannaphong <8536487+wannaphong@users.noreply.github.com>
else:
content = content + f"\n{new_section}\n"

index_path.write_text(content, encoding="utf-8")

Check failure

Code scanning / SonarCloud

I/O function calls should not be vulnerable to path injection attacks High

Change this code to not construct the path from user-controlled data. See more on SonarQube Cloud
…workflow

Co-authored-by: wannaphong <8536487+wannaphong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add automation for building PyThaiNLP/docs on new version release Automate versioned docs publishing to PyThaiNLP/docs on release Mar 14, 2026
Copilot AI requested a review from wannaphong March 14, 2026 12:14
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@coveralls
Copy link

Coverage Status

coverage: 66.312%. remained the same
when pulling 57e564c on copilot/automate-docs-build-process
into fcb9210 on dev.

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.

Automatic build document to PyThaiNLP/docs when released new version

3 participants