Add lint-changed-lines workflow (incremental linting) — supersedes #559 #482
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
| # Claude Code GitHub Action (agent mode) — caller stub for the central | |
| # d-morrison/gha reusable workflow. | |
| # | |
| # Responds to "@claude" mentions in issues, issue comments, PR review | |
| # comments, and PR reviews. Requires the CLAUDE_CODE_OAUTH_TOKEN secret. | |
| # | |
| # The reusable workflow (d-morrison/gha/.github/workflows/claude.yml) holds | |
| # the actual agent-mode machinery (branch setup, push, PR open/ready, prose | |
| # post-back, review dispatch, late-comment dedup, cost reporting) — see its | |
| # own header comment for details. This stub only holds the triggers, the | |
| # trusted-author gate, and serocalculator-specific inputs. | |
| # | |
| # `issues: assigned` is intentionally NOT included in the trigger types below | |
| # (unlike gha's own example stub): the trusted-author gate checks | |
| # `github.event.issue.author_association`, which describes the issue | |
| # *author* — not the assigner. A collaborator assigning themselves to an | |
| # outsider's issue would fail the gate, but an issue that already mentions | |
| # @claude and gets reassigned for unrelated reasons would still fire. Since | |
| # serocalculator doesn't use eager-pr (where `assigned` is most useful), | |
| # leave it out. | |
| # | |
| # Project guidance for Claude lives in .github/copilot-instructions.md. | |
| name: Claude Code | |
| on: | |
| issue_comment: | |
| types: [created] | |
| pull_request_review_comment: | |
| types: [created] | |
| issues: | |
| types: [opened] | |
| pull_request_review: | |
| types: [submitted] | |
| jobs: | |
| claude: | |
| # Cheap caller-side gate: only invoke the reusable workflow when an | |
| # @claude mention is actually present, so unrelated comment / review / | |
| # issue events don't spawn a (skipped) reusable-workflow run. The | |
| # reusable workflow still enforces the trusted-author gate | |
| # (OWNER/MEMBER/COLLABORATOR). | |
| if: | | |
| (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || | |
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || | |
| (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || | |
| (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) | |
| permissions: | |
| contents: write # so Claude can push a branch | |
| pull-requests: write # so Claude can open / edit PRs | |
| issues: write # so Claude can comment on issues | |
| id-token: write | |
| actions: write # dispatch claude-code-review.yml via `gh workflow run` | |
| uses: d-morrison/gha/.github/workflows/claude.yml@v2 | |
| secrets: | |
| CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| with: | |
| # setup-r, r-extra-packages, reviewer, review-workflow-file, and | |
| # claude-args all default to values that already match serocalculator's | |
| # prior bespoke workflow (DESCRIPTION-based deps via | |
| # setup-r-dependencies, no renv, d-morrison as reviewer). | |
| prompt-addendum: | | |
| This is the serocalculator R package. Follow | |
| `.github/copilot-instructions.md`. Before committing code changes, | |
| run the relevant pre-commit checks: | |
| - `Rscript -e 'devtools::document()'` after editing roxygen2 | |
| comments (keeps man/, NAMESPACE, DESCRIPTION in sync). | |
| - `Rscript -e 'lintr::lint_package()'` and fix issues in | |
| changed files. | |
| - `Rscript -e 'spelling::spell_check_package()'` and fix typos | |
| (add genuine terms to inst/WORDLIST). | |
| - `Rscript -e 'devtools::test()'` for affected tests. | |
| - Add a NEWS.md bullet for any user-facing change. |