mvp-0.0.1 #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .github/workflows/claude.yml | |
| name: Claude (on-mention assistant) | |
| on: | |
| issue_comment: | |
| types: [created] | |
| pull_request_review_comment: | |
| types: [created] | |
| pull_request_review: | |
| types: [submitted] | |
| concurrency: | |
| group: claude-on-mention-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| claude-assistant: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write # needed for gh pr comment | |
| issues: write # fallback to issue comment when not a PR | |
| id-token: write | |
| actions: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Load CLAUDE.md (optional rules) | |
| id: rules | |
| shell: bash | |
| run: | | |
| echo 'guidelines<<EOF' >> "$GITHUB_OUTPUT" | |
| if [ -f CLAUDE.md ]; then | |
| sed -n '1,6000p' CLAUDE.md | |
| else | |
| echo 'No CLAUDE.md present.' | |
| fi >> "$GITHUB_OUTPUT" | |
| echo 'EOF' >> "$GITHUB_OUTPUT" | |
| - name: Run Claude Code Action (auto-detects @claude) | |
| id: claude | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| # IMPORTANT: Explicitly instruct Claude to publish via gh pr comment | |
| prompt: | | |
| You are the repository’s assistant/reviewer. When you see the phrase "full audit" | |
| in the triggering comment, run a repository-wide CLAUDE.md audit and **publish the | |
| results using the GitHub CLI**. | |
| Audit scope: | |
| - Enumerate files: | |
| git ls-files '*.scala' '*.sbt' '.scalafmt.conf' 'build.sbt' 'project/*.sbt' 'project/*.scala' 'project/build.properties' | |
| - Apply ALL rules from CLAUDE.md to each file. | |
| - Produce a single markdown report grouped by file, with ✅/❌ per rule and minimal patch suggestions. | |
| - At the end of the report, include: | |
| CLAUDE_RULES_STATUS: PASS # or FAIL | |
| PUBLISHING (MANDATORY): | |
| - Determine the PR number from the environment: | |
| use $PR_NUMBER if set; else use $ISSUE_NUMBER. | |
| - If a PR number is available: | |
| run exactly one Bash command to post your report: | |
| gh pr comment "$PR_NUMBER" --body-file - <<'MD' | |
| <PASTE YOUR FULL MARKDOWN REPORT HERE> | |
| MD | |
| - Else (issue context), post to the issue instead: | |
| gh issue comment "$ISSUE_NUMBER" --body-file - <<'MD' | |
| <PASTE YOUR FULL MARKDOWN REPORT HERE> | |
| MD | |
| Project standards (from CLAUDE.md): | |
| --- | |
| ${{ steps.rules.outputs.guidelines }} | |
| --- | |
| # Allow Claude to enumerate files and publish via gh CLI | |
| claude_args: >- | |
| --allowedTools | |
| "Read" | |
| "Edit" | |
| "MultiEdit" | |
| "Bash(git ls-files:*)" | |
| "Bash(rg:*)" | |
| "Bash(find:*)" | |
| "Bash(gh pr view:*)" | |
| "Bash(gh pr comment:*)" | |
| "Bash(gh issue comment:*)" | |
| --max-turns 8 | |
| --verbose | |
| env: | |
| GH_TOKEN: ${{ github.token }} # gh CLI auth | |
| # Provide both; prompt explains which to use | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| - name: Job summary (non-blocking) | |
| if: always() | |
| run: | | |
| echo "### Claude on-mention run" >> "$GITHUB_STEP_SUMMARY" | |
| echo "If you requested a 'full audit', the report should now be posted via gh CLI." >> "$GITHUB_STEP_SUMMARY" |