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 siteConfiguring documentation standards or generators (
/configure:docs
instead)
Creating or updating a GitHub Actions workflow for Pages deploymentDebugging a failed GitHub Actions workflow (
/configure:workflows
instead)
Migrating from
peaceiris/actions-gh-pages
to official
actions/deploy-pages
Editing documentation content or markdown files
Auditing Pages workflow for outdated action versions or missing permissionsSetting up a custom domain via DNS (manual repository settings)
Adding Pages deployment to a project with an existing doc generatorConfiguring CI/CD workflows unrelated to documentation
使用该技能的场景...使用其他方法的场景...
为文档站点设置GitHub Pages部署配置文档标准或生成器(改用
/configure:docs
创建或更新用于Pages部署的GitHub Actions工作流调试失败的GitHub Actions工作流(改用
/configure:workflows
peaceiris/actions-gh-pages
迁移至官方
actions/deploy-pages
编辑文档内容或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:
  • --check-only
    : Report compliance status without modifications (CI/CD mode)
  • --fix
    : Apply fixes automatically without prompting
  • --source <docs|site|custom>
    : Override source directory detection
从命令参数中解析:
  • --check-only
    : 仅报告合规状态,不进行修改(CI/CD模式)
  • --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 FileGeneratorOutput Directory
typedoc.json
TypeDoc
docs/
or configured
mkdocs.yml
MkDocs
site/
docs/conf.py
Sphinx
docs/_build/html/
docusaurus.config.js
Docusaurus
build/
Cargo.toml
(with rustdoc)
rustdoc
target/doc/
NoneStatic
docs/
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.json
TypeDoc
docs/
或自定义配置
mkdocs.yml
MkDocs
site/
docs/conf.py
Sphinx
docs/_build/html/
docusaurus.config.js
Docusaurus
build/
Cargo.toml
(含rustdoc)
rustdoc
target/doc/
静态文件
docs/
如果未检测到文档配置,输出:
未检测到文档生成器。

建议先运行/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-pages
  • actions/upload-pages-artifact
  • peaceiris/actions-gh-pages
Extract from existing workflow: current action versions, permissions, build steps, source directory.
检查是否存在GitHub Pages工作流,搜索以下内容:
  • actions/deploy-pages
  • actions/upload-pages-artifact
  • peaceiris/actions-gh-pages
从现有工作流中提取:当前Action版本、权限、构建步骤、源目录。

Step 3: Check compliance against standards

步骤3: 检查是否符合标准

Validate GitHub Actions workflow against standards:
CheckStandardSeverity
actions/deploy-pages
v4+WARN if older
actions/configure-pages
v5+WARN if missing
actions/upload-pages-artifact
v3+WARN if older
Permissions
pages: write
,
id-token: write
FAIL if missing
Environment
github-pages
WARN if missing
ConcurrencyGroup definedINFO
验证GitHub Actions工作流是否符合标准:
检查项标准严重程度
actions/deploy-pages
v4及以上版本过旧时发出警告
actions/configure-pages
v5及以上缺失时发出警告
actions/upload-pages-artifact
v3及以上版本过旧时发出警告
权限
pages: write
,
id-token: write
缺失时判定失败
环境
github-pages
缺失时发出警告
并发控制已定义分组信息提示

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
--check-only
, stop here.
打印格式化的合规报告:
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-only
参数,在此步骤停止。

Step 5: Create or update workflow (if --fix or user confirms)

步骤5: 创建或更新工作流(若使用--fix或用户确认)

Create
.github/workflows/docs.yml
based on detected generator. Use the appropriate workflow template from REFERENCE.md:
  • 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
    ./docs
    directory
All workflows include:
  • Required permissions (
    pages: write
    ,
    id-token: write
    )
  • Concurrency group to prevent conflicts
  • workflow_dispatch
    for manual triggers
  • Path-based triggers for relevant source files
根据检测到的生成器创建
.github/workflows/docs.yml
。使用REFERENCE.md中的相应工作流模板:
  • 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.yaml
:
yaml
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.yaml
:
yaml
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 rules
For 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:
  1. Compliance report with documentation and workflow status
  2. List of changes made (if --fix) or proposed (if interactive)
  3. Post-configuration instructions
  4. URL where docs will be deployed
提供:
  1. 包含文档和工作流状态的合规报告
  2. 已执行的更改列表(若使用--fix)或建议的更改列表(若为交互式模式)
  3. 配置后操作说明
  4. 文档将部署到的URL地址

Agentic Optimizations

智能优化选项

ContextCommand
Quick compliance check
/configure:github-pages --check-only
Auto-fix all issues
/configure:github-pages --fix
Check Pages workflow exists
find .github/workflows -name '*pages*' -o -name '*doc*' 2>/dev/null
Check Pages action versions`grep -E 'deploy-pages
Verify Pages enabled
gh api repos/{owner}/{repo}/pages --jq '.status'
Check deployment status
gh api repos/{owner}/{repo}/pages/builds --jq '.[0].status'
上下文命令
快速合规性检查
/configure:github-pages --check-only
自动修复所有问题
/configure:github-pages --fix
检查Pages工作流是否存在
find .github/workflows -name '*pages*' -o -name '*doc*' 2>/dev/null
检查Pages Action版本`grep -E 'deploy-pages
验证Pages是否启用
gh api repos/{owner}/{repo}/pages --jq '.status'
检查部署状态
gh api repos/{owner}/{repo}/pages/builds --jq '.[0].status'

See Also

另请参阅

  • /configure:docs
    - Set up documentation standards and generators
  • /configure:workflows
    - GitHub Actions workflow standards
  • /configure:all
    - Run all compliance checks
  • /configure:status
    - Quick compliance overview
  • /configure:docs
    - 设置文档标准和生成器
  • /configure:workflows
    - GitHub Actions工作流标准
  • /configure:all
    - 运行所有合规性检查
  • /configure:status
    - 快速合规性概览