|
| 1 | +name: Claude Quality Gate |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main, test] |
| 6 | + types: [opened, synchronize, reopened] |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + pull-requests: write |
| 11 | + issues: write |
| 12 | + id-token: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + # Agent 1 — verify tests exist for all changed code |
| 16 | + test-coverage-agent: |
| 17 | + name: Test Coverage Agent |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - uses: anthropics/claude-code-action@v1 |
| 25 | + with: |
| 26 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 27 | + prompt: | |
| 28 | + You are a test quality agent for the ptop3 project. |
| 29 | +
|
| 30 | + Review the diff of this PR (compare HEAD to the base branch) and: |
| 31 | + 1. List every new or modified function/method in ptop3/ source files. |
| 32 | + 2. Check tests/ to confirm each one has a corresponding test. |
| 33 | + 3. For any function missing a test, post a PR comment that: |
| 34 | + - Identifies the untested function (module + name). |
| 35 | + - Provides a ready-to-use test snippet following the project rules: |
| 36 | + * Mock /proc/* files with tmp_path fixtures |
| 37 | + * Mock curses — never test TUI rendering directly |
| 38 | + * Patch os.geteuid for root-required paths |
| 39 | + * Tests must pass on Python 3.10–3.13 |
| 40 | + 4. If all functions are covered, post a short confirmation comment. |
| 41 | +
|
| 42 | + Do NOT modify files or create commits. All feedback must be via PR comments. |
| 43 | + Project test style is in tests/conftest.py and existing test files. |
| 44 | + Quality rules are in .github/instructions/code-review.instructions.md. |
| 45 | +
|
| 46 | + # Agent 2 — verify CHANGELOG and docs are updated |
| 47 | + docs-changelog-agent: |
| 48 | + name: Docs & Changelog Agent |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + with: |
| 53 | + fetch-depth: 0 |
| 54 | + |
| 55 | + - uses: anthropics/claude-code-action@v1 |
| 56 | + with: |
| 57 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 58 | + prompt: | |
| 59 | + You are a documentation quality agent for the ptop3 project. |
| 60 | +
|
| 61 | + Review the diff of this PR and: |
| 62 | +
|
| 63 | + 1. CHANGELOG check: |
| 64 | + - If any user-facing behavior changed (new feature, bug fix, CLI flag, keybinding), |
| 65 | + verify CHANGELOG.md has an entry under ## [Unreleased]. |
| 66 | + - If missing, post a PR comment that states what is missing and proposes |
| 67 | + the exact text to add under the correct section |
| 68 | + (Added / Changed / Fixed / Security / Deprecated / Removed). |
| 69 | + - Do NOT bump version numbers. |
| 70 | +
|
| 71 | + 2. README check: |
| 72 | + - If new keybindings, CLI flags, or entry points were added, verify README.md documents them. |
| 73 | + - If missing, post a PR comment explaining what is missing and proposing |
| 74 | + the exact wording or patch snippet to add. |
| 75 | +
|
| 76 | + 3. Docstring check: |
| 77 | + - For any new public function in ptop3/ that lacks a docstring, post a PR comment |
| 78 | + identifying the function (module, name, signature) and proposing a one-line docstring. |
| 79 | +
|
| 80 | + Do NOT modify files or create commits. All feedback must be via PR comments. |
| 81 | + If everything is already documented, post a short confirmation comment summarising what you checked. |
| 82 | +
|
| 83 | + # Agent 3 — code quality and security review |
| 84 | + code-review-agent: |
| 85 | + name: Code Review Agent |
| 86 | + runs-on: ubuntu-latest |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + fetch-depth: 0 |
| 91 | + |
| 92 | + - uses: anthropics/claude-code-action@v1 |
| 93 | + with: |
| 94 | + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
| 95 | + prompt: | |
| 96 | + You are a code quality and security agent for the ptop3 project. |
| 97 | +
|
| 98 | + Review the diff of this PR against the standards in |
| 99 | + .github/instructions/code-review.instructions.md and check for: |
| 100 | +
|
| 101 | + 1. Style violations: bare except, print() in library code, typing.Dict/List/Optional, |
| 102 | + shell=True in subprocess, string path concatenation instead of pathlib. |
| 103 | + 2. Security issues: unsanitized input to subprocess, hardcoded secrets, |
| 104 | + missing root check before writing /proc/sys/vm/drop_caches or calling swapoff/swapon, |
| 105 | + missing visudo validation before sudoers writes. |
| 106 | + 3. GitHub Actions: missing permissions blocks, missing skip-existing on TestPyPI steps. |
| 107 | + 4. Module-specific rules from the instructions file. |
| 108 | +
|
| 109 | + For each issue found, post an inline PR review comment at the exact file+line |
| 110 | + with a clear explanation and a concrete suggested fix. |
| 111 | +
|
| 112 | + Do NOT modify files or create commits. All feedback must be via PR comments. |
| 113 | + If no issues are found, post a brief approval comment summarising what was checked. |
0 commit comments