你会建立什么
这篇教学会示范如何把 Claude Code GitHub Actions 当成 comment-only SEO/GEO PR reviewer。初学者安全版本不会 rewrite PR。它 review risky changes、留下带 file references 的 findings,并告诉 human reviewer merge 前该 verify 什么。
你会建立:
.github/workflows/claude-seo-geo-review.yml
.github/seo-geo-review-prompt.md
CLAUDE.md additions for PR review
seo-geo/pr-review/checklist.md
图说:第一版保持 comment-only:不 push commits、不 publish、不 submit URLs。
用在会碰 metadata、schema、page templates、internal links、robots、sitemaps、canonical logic、redirects、analytics、docs 或 large content batches 的 pull requests。
步骤 1:决定哪些 PRs 需要 review
先从 path filters 开始。不要对每个 tiny dependency 或 styling PR 都跑 AI review。
| PR file pattern | 为什么重要 |
|---|---|
| src/lib/seo.* | Titles、descriptions、canonical URLs、robots tags |
| src/components/Schema | Structured data 和 rich-result eligibility |
| robots.txt, sitemap* | Crawl 和 indexing access |
| middleware., routes/ | Redirects、localization、route behavior |
| src/pages/, app/, content/** | 页面内容和答案抽取 |
| i18n/, locales/ | hreflang 和 translated metadata |
| analytics/, gtm/ | Measurement integrity |
建立 checklist file:
mkdir -p .github seo-geo/pr-review
cat > seo-geo/pr-review/checklist.md <<'EOF2'
# SEO/GEO PR Review Checklist
Review risks:
- title, meta description, canonical, robots, noindex
- sitemap, redirects, route generation, localization
- schema and JSON-LD validity
- internal links and navigation changes
- answer extraction: concise answer, evidence, FAQ, tables
- unsupported claims, invented proof, outdated stats
- analytics and conversion tracking changes
- build, lint, tests, or preview validation
Review output:
- severity: blocking / important / note
- file reference
- risk
- why it matters for SEO/GEO
- verification step
EOF2
步骤 2:把 review prompt 写成 file
Prompt 放在 file 里,之后更容易改善。
cat > .github/seo-geo-review-prompt.md <<'EOF2'
Review this pull request for SEO and GEO risk.
Act as a conservative reviewer. Do not rewrite the PR unless explicitly asked.
Focus on:
- title, meta description, canonical, robots, noindex
- sitemap generation, redirects, route changes, localization, hreflang
- schema / JSON-LD validity and unsupported claims
- internal links, navigation, breadcrumbs, related content
- content that is too generic for AI answer extraction
- missing evidence, screenshots, examples, or citations
- analytics / GTM / GA4 changes
- build, lint, test, preview, and crawl validation gaps
Return findings in this format:
## Blocking
- `file`: risk, why it matters, exact verification step
## Important
- `file`: risk, why it matters, exact verification step
## Notes
- `file`: smaller improvement or follow-up
If there are no findings, say that explicitly and list residual risks.
EOF2
步骤 3:请 Claude Code 产生 current workflow
Claude Code GitHub Actions setup 可能依 current action package、GitHub app setup、repository permissions 和 secrets 而不同。不要 silent guessing,请 Claude Code 依 repo 产生 workflow:
Help me set up Claude Code GitHub Actions for comment-only SEO/GEO PR review.
Use:
- `.github/seo-geo-review-prompt.md`
- `seo-geo/pr-review/checklist.md`
Requirements:
- Trigger only on pull requests that touch SEO/GEO-relevant paths.
- Comment findings on the PR.
- Do not push commits.
- Do not publish, deploy, submit URLs, or change secrets.
- Use the current Claude Code GitHub Action syntax from the installed/current docs.
- Tell me which GitHub app, permissions, and secrets are required.
- Create the workflow file only after explaining the plan.
步骤 4:starter workflow shape
最终 workflow 会因目前 Claude Code GitHub Action version 而不同,但 shape 应接近:
name: Claude SEO/GEO PR Review
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'src/**'
- 'app/**'
- 'pages/**'
- 'content/**'
- 'public/robots.txt'
- '**/sitemap*'
- '**/*schema*'
- '**/*seo*'
- '**/*metadata*'
- '.github/seo-geo-review-prompt.md'
- 'CLAUDE.md'
permissions:
contents: read
pull-requests: write
issues: write
jobs:
seo-geo-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Replace this with the current Claude Code GitHub Action block
# recommended by Anthropic's docs for your account.
- name: Claude SEO/GEO review
uses: anthropics/claude-code-action@beta
with:
prompt_file: .github/seo-geo-review-prompt.md
allowed_tools: 'Bash(git diff:*),Bash(git status:*),Bash(cat:*),Bash(ls:*)'
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
Commit 前,请用官方 Claude Code GitHub Actions docs 验证 action name、inputs、authentication mode 和 permissions。如果 organization 使用 Claude GitHub app,而不是 API key workflow,就遵循那套 setup。
步骤 5:让 workflow 保持 review-only
第一版应该很 boring:
contents: read,不是 write- 允许 PR comments
- 没有 deployment tokens
- 没有 CMS tokens
- 没有 Search Console 或 Bing submit credentials
- 没有 automatic commits
- 没有 merge permission
如果 Claude 建议 broad permissions,问:
Reduce this GitHub Actions workflow to comment-only PR review. Explain every permission. Remove anything required for pushing commits, deployment, publishing, or URL submission.
步骤 6:用 tiny PR 测试
建立一个只改 safe title 或 markdown page 的 branch:
git checkout -b test/claude-seo-geo-review
做一个小 content change,开 PR,然后 comment:
@claude Review this PR for SEO/GEO risk using .github/seo-geo-review-prompt.md. Do not make changes.
好的 finding:
Important - src/lib/seo.ts: the canonical helper now removes locale prefixes. This may cause localized pages to canonicalize to English URLs. Verify canonical/hreflang output on one English page and one translated page before merge.
弱 finding:
Improve SEO.
如果 comments vague,收紧 prompt file 和 checklist。
步骤 7:把 repo-specific rules 加到 CLAUDE.md
Repo rules 越明确,Claude 的 PR review 越好:
## PR review rules for SEO/GEO
When reviewing PRs:
- findings first, ordered by severity
- include file references and verification steps
- do not request vague SEO improvements
- never invent product claims, customer proof, ranking data, or statistics
- treat robots, sitemap, canonical, noindex, schema, redirects, analytics, and localization changes as high risk
- if no issues are found, state residual risks and testing gaps
步骤 8:小心从 comment-only 进阶到 suggested patches
Comment-only reviews 有用后,再考虑 automatic edits。即便如此,也只把 patch suggestions 限制在低风险 items:
| Safe-ish patch | Still needs review |
|---|---|
| missing alt text | yes |
| duplicate meta description on one page | yes |
| broken internal link in markdown | yes |
| typo in FAQ heading | yes |
这些保持 human-only:
- redirects and migrations
- robots/noindex changes
- canonical policy
- analytics and tag manager changes
- legal、medical、financial 或 competitor claims
- case-study proof 和 customer logos
FAQ
每个 PR 都应该 trigger Claude review 吗?
不用。使用 path filters。只在 SEO、content、routing、schema、localization、analytics 和 page-template changes 触发。
GitHub Actions 可以取代 SEO reviewer 吗?
不行。它能抓 repeatable risks,并在 PR 里建立 checklist。Strategy、claims 和 release timing 仍由人决定。
如果 action 无法 access secrets 怎么办?
保持 workflow comment-only,并依官方 Claude Code GitHub Actions setup 修 authentication。不要把 API keys 贴进 workflow files 或 PR comments。
Claude Code SEO/GEO 学习路径
这篇属于 Claude Code SEO/GEO operator series。如果你从零建立 workflow,请照这个顺序:
- 如何用 Claude Code 做 SEO Automation
- 如何建立 Claude Code SEO/GEO Workflow Cockpit
- 如何把 CLAUDE.md 和 Memory 用在 SEO/GEO Workflows
- 如何用 Claude Code VS Code Extension 更新 SEO Pages
- 2026 年最佳 GEO Claude Code Skills
- 如何用 Claude Code Subagents 做 GEO Research
- 如何把 Claude Code Hooks 当成 SEO/GEO Quality Gates
- 如何用 MCP 将 Claude Code 接上 SEO 资料
- 如何用 Claude Code GitHub Actions 做 SEO/GEO Reviews
- 如何在 Claude Code 里跑每日 SEO/GEO Monitoring
Sources and notes
- Anthropic Claude Code docs: GitHub Actions and Claude Code overview 。
Author: Tessa Clarke,Auspia 120+ editorial systems 的 Content Governance Lead。Tessa 撰写审核系统、发布标准与安全 AI-assisted content operations。