Files
openmlsys-zh/tests/test_update_docs_workflow.py
Chivier Humber c48d3cb394 ci: deploy docs with an SSH deploy key instead of a PAT
The DEPLOY_TOKEN personal access token expired, so pushing to
openmlsys.github.io failed with "Invalid username or token". Use a
write-enabled deploy key scoped to that repository (DEPLOY_KEY secret),
which does not expire and is not tied to a personal account. GitHub's
SSH host key is pinned instead of trusting ssh-keyscan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:14:12 +00:00

32 lines
1.2 KiB
Python

from __future__ import annotations
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
WORKFLOW_PATH = REPO_ROOT / ".github" / "workflows" / "update_docs.yml"
CI_WORKFLOW_PATH = REPO_ROOT / ".github" / "workflows" / "main.yml"
class UpdateDocsWorkflowTests(unittest.TestCase):
def test_workflow_deploys_to_openmlsys_github_io(self) -> None:
workflow = WORKFLOW_PATH.read_text(encoding="utf-8")
self.assertIn("secrets.DEPLOY_KEY", workflow)
self.assertIn("git@github.com:openmlsys/openmlsys.github.io.git", workflow)
self.assertNotIn("DEPLOY_TOKEN", workflow)
self.assertIn("openmlsys.github.io", workflow)
self.assertIn("git push", workflow)
def test_workflows_use_peaceiris_mdbook_action(self) -> None:
for workflow_path in (WORKFLOW_PATH, CI_WORKFLOW_PATH):
workflow = workflow_path.read_text(encoding="utf-8")
self.assertIn("uses: peaceiris/actions-mdbook@v2", workflow, workflow_path.as_posix())
self.assertIn("mdbook-version: 'latest'", workflow, workflow_path.as_posix())
self.assertNotIn("cargo install mdbook --locked", workflow, workflow_path.as_posix())
if __name__ == "__main__":
unittest.main()