Skip to content

Commit eaf31f8

Browse files
authored
🚵 [claude] Add Claude Code GitHub Workflow (#5)
* "Claude PR Assistant workflow" * "Claude Code Review workflow" * better security * adopt Claude with /init
1 parent 050a506 commit eaf31f8

File tree

4 files changed

+175
-0
lines changed

4 files changed

+175
-0
lines changed

.claude/settings.local.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(hugo:*)"
5+
],
6+
"deny": [],
7+
"ask": []
8+
}
9+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
# global permissions
14+
permissions: {}
15+
16+
jobs:
17+
claude-review:
18+
# Optional: Filter by PR author
19+
# if: |
20+
# github.event.pull_request.user.login == 'external-contributor' ||
21+
# github.event.pull_request.user.login == 'new-developer' ||
22+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
23+
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
pull-requests: read
28+
issues: read
29+
id-token: write
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 1
36+
37+
- name: Run Claude Code Review
38+
id: claude-review
39+
uses: anthropics/claude-code-action@v1
40+
with:
41+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
42+
prompt: |
43+
REPO: ${{ github.repository }}
44+
PR NUMBER: ${{ github.event.pull_request.number }}
45+
46+
Please review this pull request and provide feedback on:
47+
- Code quality and best practices
48+
- Potential bugs or issues
49+
- Performance considerations
50+
- Security concerns
51+
- Test coverage
52+
53+
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
54+
55+
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
56+
57+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
58+
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
59+
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
60+

.github/workflows/claude.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
# global permissions
14+
permissions: {}
15+
16+
jobs:
17+
claude:
18+
if: |
19+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
20+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
21+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
22+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
pull-requests: read
27+
issues: read
28+
id-token: write
29+
actions: read # Required for Claude to read CI results on PRs
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 1
35+
36+
- name: Run Claude Code
37+
id: claude
38+
uses: anthropics/claude-code-action@v1
39+
with:
40+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
41+
42+
# This is an optional setting that allows Claude to read CI results on PRs
43+
additional_permissions: |
44+
actions: read
45+
46+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
47+
# prompt: 'Update the pull request description to include a summary of changes.'
48+
49+
# Optional: Add claude_args to customize behavior and configuration
50+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
51+
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
52+
# claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'
53+

CLAUDE.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is a Hugo-based static website for the FINI Domain Trust project, which maintains domain ownership to prevent spam and abuse. The site is published to GitHub Pages via GitHub Actions.
8+
9+
## Architecture
10+
11+
- **Hugo Site Root**: `trust/` directory contains all Hugo configuration and content
12+
- **Theme**: Uses the Ananke theme as a git submodule at `trust/themes/ananke`
13+
- **Published Output**: `trust/public/` directory (symlinked as `html` at repo root)
14+
- **GitHub Pages**: Automated deployment via `.github/workflows/github-pages.yml` which pushes `trust/public` to the `gh-pages` branch on every push to `main`
15+
16+
## Common Commands
17+
18+
All Hugo commands must be run from the `trust/` directory:
19+
20+
```bash
21+
cd trust
22+
23+
# Build the site (generates static files in public/)
24+
hugo
25+
26+
# Run development server with live reload
27+
hugo server
28+
29+
# Run development server with drafts visible
30+
hugo server -D
31+
32+
# Clean build artifacts
33+
rm -rf public/ resources/
34+
```
35+
36+
## Content Structure
37+
38+
- **Main Content**: `trust/content/_index.md` is the homepage
39+
- **Configuration**: `trust/hugo.toml` contains site configuration and social links
40+
- **Static Assets**: `trust/static/` for images and other static files
41+
- **Archetypes**: `trust/archetypes/default.md` for content templates
42+
43+
## Git Submodules
44+
45+
The Ananke theme is included as a git submodule. When cloning fresh or after theme updates:
46+
47+
```bash
48+
git submodule update --init --recursive
49+
```
50+
51+
## Deployment
52+
53+
The site automatically deploys to GitHub Pages when changes are pushed to `main`. The workflow builds Hugo if needed (though currently commented out) and publishes `trust/public/` to the `gh-pages` branch.

0 commit comments

Comments
 (0)