configure-github-pages
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/configure:github-pages
/configure:github-pages
Check and configure GitHub Pages deployment.
检查并配置GitHub Pages部署。
When to Use This Skill
何时使用该技能
| Use this skill when... | Use another approach when... |
|---|---|
| Setting up GitHub Pages deployment for a documentation site | Configuring documentation standards or generators ( |
| Creating or updating a GitHub Actions workflow for Pages deployment | Debugging a failed GitHub Actions workflow ( |
Migrating from | Editing documentation content or markdown files |
| Auditing Pages workflow for outdated action versions or missing permissions | Setting up a custom domain via DNS (manual repository settings) |
| Adding Pages deployment to a project with an existing doc generator | Configuring CI/CD workflows unrelated to documentation |
| 使用该技能的场景... | 使用其他方法的场景... |
|---|---|
| 为文档站点设置GitHub Pages部署 | 配置文档标准或生成器(改用 |
| 创建或更新用于Pages部署的GitHub Actions工作流 | 调试失败的GitHub Actions工作流(改用 |
从 | 编辑文档内容或Markdown文件 |
| 审计Pages工作流是否存在过时的Action版本或缺失的权限 | 通过DNS设置自定义域名(手动仓库设置) |
| 为已有文档生成器的项目添加Pages部署 | 配置与文档无关的CI/CD工作流 |
Context
上下文信息
- GitHub workflows: !
find .github/workflows -maxdepth 1 \( -name '*doc*.yml' -o -name '*pages*.yml' \) 2>/dev/null - Documentation config: !
find . -maxdepth 1 \( -name 'mkdocs.yml' -o -name 'typedoc.json' -o -name 'docusaurus.config.*' \) 2>/dev/null - Docs directory: !
find . -maxdepth 1 -type d \( -name 'docs' -o -name 'site' \) 2>/dev/null - CNAME file: !
find . -maxdepth 1 -name 'CNAME' 2>/dev/null - Project standards: !
find . -maxdepth 1 -name '.project-standards.yaml' 2>/dev/null
- GitHub工作流: !
find .github/workflows -maxdepth 1 \( -name '*doc*.yml' -o -name '*pages*.yml' \) 2>/dev/null - 文档配置: !
find . -maxdepth 1 \( -name 'mkdocs.yml' -o -name 'typedoc.json' -o -name 'docusaurus.config.*' \) 2>/dev/null - 文档目录: !
find . -maxdepth 1 -type d \( -name 'docs' -o -name 'site' \) 2>/dev/null - CNAME文件: !
find . -maxdepth 1 -name 'CNAME' 2>/dev/null - 项目标准: !
find . -maxdepth 1 -name '.project-standards.yaml' 2>/dev/null
Parameters
参数
Parse from command arguments:
- : Report compliance status without modifications (CI/CD mode)
--check-only - : Apply fixes automatically without prompting
--fix - : Override source directory detection
--source <docs|site|custom>
从命令参数中解析:
- : 仅报告合规状态,不进行修改(CI/CD模式)
--check-only - : 自动应用修复,无需提示
--fix - : 覆盖自动检测的源目录
--source <docs|site|custom>
Execution
执行步骤
Execute this GitHub Pages deployment configuration check:
执行该GitHub Pages部署配置检查:
Step 1: Detect documentation state
步骤1: 检测文档状态
Identify existing documentation configuration:
| Config File | Generator | Output Directory |
|---|---|---|
| TypeDoc | |
| MkDocs | |
| Sphinx | |
| Docusaurus | |
| rustdoc | |
| None | Static | |
If no documentation configured, report:
No documentation generator detected.
Consider running /configure:docs first to:
- Set up documentation linting standards
- Configure a documentation generator
Would you like to:
[A] Configure documentation first (/configure:docs)
[B] Set up static HTML hosting for existing docs/ directory
[C] Skip - I'll configure docs later识别现有文档配置:
| 配置文件 | 生成器 | 输出目录 |
|---|---|---|
| TypeDoc | |
| MkDocs | |
| Sphinx | |
| Docusaurus | |
| rustdoc | |
| 无 | 静态文件 | |
如果未检测到文档配置,输出:
未检测到文档生成器。
建议先运行/configure:docs来:
- 设置文档检查标准
- 配置文档生成器
您希望:
[A] 先配置文档(/configure:docs)
[B] 为现有docs/目录设置静态HTML托管
[C] 跳过 - 我稍后再配置文档Step 2: Analyze existing workflow
步骤2: 分析现有工作流
Check for existing GitHub Pages workflows by searching for:
actions/deploy-pagesactions/upload-pages-artifactpeaceiris/actions-gh-pages
Extract from existing workflow: current action versions, permissions, build steps, source directory.
检查是否存在GitHub Pages工作流,搜索以下内容:
actions/deploy-pagesactions/upload-pages-artifactpeaceiris/actions-gh-pages
从现有工作流中提取:当前Action版本、权限、构建步骤、源目录。
Step 3: Check compliance against standards
步骤3: 检查是否符合标准
Validate GitHub Actions workflow against standards:
| Check | Standard | Severity |
|---|---|---|
| v4+ | WARN if older |
| v5+ | WARN if missing |
| v3+ | WARN if older |
| Permissions | | FAIL if missing |
| Environment | | WARN if missing |
| Concurrency | Group defined | INFO |
验证GitHub Actions工作流是否符合标准:
| 检查项 | 标准 | 严重程度 |
|---|---|---|
| v4及以上 | 版本过旧时发出警告 |
| v5及以上 | 缺失时发出警告 |
| v3及以上 | 版本过旧时发出警告 |
| 权限 | | 缺失时判定失败 |
| 环境 | | 缺失时发出警告 |
| 并发控制 | 已定义分组 | 信息提示 |
Step 4: Generate compliance report
步骤4: 生成合规报告
Print a formatted compliance report:
GitHub Pages Compliance Report
==============================
Project: [name]
Documentation Status:
Generator [typedoc|mkdocs|sphinx|rustdoc|static|not configured]
Source directory [docs/|site/|custom]
Build command [detected command or "not configured"]
GitHub Pages Workflow:
Workflow file .github/workflows/docs.yml [EXISTS | MISSING]
Workflow Checks (if exists):
deploy-pages v4 [PASS | OUTDATED | MISSING]
configure-pages v5 [PASS | MISSING]
upload-artifact v3 [PASS | OUTDATED]
Permissions pages: write, id-token [PASS | MISSING]
Environment github-pages [PASS | MISSING]
Overall: [X issues found]
Recommendations:
[List specific fixes needed]If , stop here.
--check-only打印格式化的合规报告:
GitHub Pages合规报告
==============================
项目: [名称]
文档状态:
生成器 [typedoc|mkdocs|sphinx|rustdoc|静态|未配置]
源目录 [docs/|site/|自定义]
构建命令 [检测到的命令或"未配置"]
GitHub Pages工作流:
工作流文件 .github/workflows/docs.yml [已存在 | 缺失]
工作流检查(若存在):
deploy-pages v4 [通过 | 过时 | 缺失]
configure-pages v5 [通过 | 缺失]
upload-artifact v3 [通过 | 过时]
权限 pages: write, id-token [通过 | 缺失]
环境 github-pages [通过 | 缺失]
总体: [发现X个问题]
建议:
[列出具体需要修复的内容]如果使用参数,在此步骤停止。
--check-onlyStep 5: Create or update workflow (if --fix or user confirms)
步骤5: 创建或更新工作流(若使用--fix或用户确认)
Create based on detected generator. Use the appropriate workflow template from REFERENCE.md:
.github/workflows/docs.yml- TypeDoc: Node.js setup, npm ci, npm run docs:build, upload
./docs - MkDocs: Python setup, pip install, mkdocs build, upload
./site - Sphinx: Python setup, pip install, make html, upload
./docs/_build/html - rustdoc: Rust toolchain, cargo doc, create index redirect, upload
./target/doc - Static HTML: Direct upload from directory
./docs
All workflows include:
- Required permissions (,
pages: write)id-token: write - Concurrency group to prevent conflicts
- for manual triggers
workflow_dispatch - Path-based triggers for relevant source files
根据检测到的生成器创建。使用REFERENCE.md中的相应工作流模板:
.github/workflows/docs.yml- TypeDoc: Node.js环境配置、npm ci、npm run docs:build、上传
./docs - MkDocs: Python环境配置、pip安装依赖、mkdocs build、上传
./site - Sphinx: Python环境配置、pip安装依赖、make html、上传
./docs/_build/html - rustdoc: Rust工具链配置、cargo doc、创建索引重定向、上传
./target/doc - 静态HTML: 直接从目录上传
./docs
所有工作流包含:
- 必需权限(,
pages: write)id-token: write - 并发控制分组以避免冲突
- 用于手动触发
workflow_dispatch - 基于相关源文件的路径触发规则
Step 6: Update standards tracking
步骤6: 更新标准跟踪文件
Update :
.project-standards.yamlyaml
standards_version: "2025.1"
last_configured: "[timestamp]"
components:
github-pages: "2025.1"
github-pages-generator: "[typedoc|mkdocs|sphinx|rustdoc|static]"
github-pages-source: "[docs/|site/|custom]"更新:
.project-standards.yamlyaml
standards_version: "2025.1"
last_configured: "[时间戳]"
components:
github-pages: "2025.1"
github-pages-generator: "[typedoc|mkdocs|sphinx|rustdoc|static]"
github-pages-source: "[docs/|site/|custom]"Step 7: Print post-configuration instructions
步骤7: 打印配置后说明
GitHub Pages Configuration Complete
===================================
Workflow created: .github/workflows/docs.yml
Next Steps:
1. Enable GitHub Pages in repository settings:
Settings -> Pages -> Source: GitHub Actions
2. Push to main branch to trigger deployment:
git add .github/workflows/docs.yml
git commit -m "ci(docs): add GitHub Pages deployment workflow"
git push
3. After deployment, your docs will be available at:
https://OWNER.github.io/REPO/
Optional:
- Add custom domain: Create CNAME file with your domain
- Protect deployment: Configure environment protection rulesFor detailed workflow templates, see REFERENCE.md.
GitHub Pages配置完成
===================================
已创建工作流: .github/workflows/docs.yml
后续步骤:
1. 在仓库设置中启用GitHub Pages:
设置 -> Pages -> 源: GitHub Actions
2. 推送到主分支以触发部署:
git add .github/workflows/docs.yml
git commit -m "ci(docs): add GitHub Pages deployment workflow"
git push
3. 部署完成后,您的文档将在以下地址可用:
https://OWNER.github.io/REPO/
可选操作:
- 添加自定义域名: 创建包含您域名的CNAME文件
- 保护部署: 配置环境保护规则有关详细的工作流模板,请参阅REFERENCE.md。
Output
输出内容
Provide:
- Compliance report with documentation and workflow status
- List of changes made (if --fix) or proposed (if interactive)
- Post-configuration instructions
- URL where docs will be deployed
提供:
- 包含文档和工作流状态的合规报告
- 已执行的更改列表(若使用--fix)或建议的更改列表(若为交互式模式)
- 配置后操作说明
- 文档将部署到的URL地址
Agentic Optimizations
智能优化选项
| Context | Command |
|---|---|
| Quick compliance check | |
| Auto-fix all issues | |
| Check Pages workflow exists | |
| Check Pages action versions | `grep -E 'deploy-pages |
| Verify Pages enabled | |
| Check deployment status | |
| 上下文 | 命令 |
|---|---|
| 快速合规性检查 | |
| 自动修复所有问题 | |
| 检查Pages工作流是否存在 | |
| 检查Pages Action版本 | `grep -E 'deploy-pages |
| 验证Pages是否启用 | |
| 检查部署状态 | |
See Also
另请参阅
- - Set up documentation standards and generators
/configure:docs - - GitHub Actions workflow standards
/configure:workflows - - Run all compliance checks
/configure:all - - Quick compliance overview
/configure:status
- - 设置文档标准和生成器
/configure:docs - - GitHub Actions工作流标准
/configure:workflows - - 运行所有合规性检查
/configure:all - - 快速合规性概览
/configure:status