Skip to content

armgit / lyftr

Public Imported from GitHub
0

Self-hosted fitness tracker. Log workouts, track nutrition, and monitor progress. Docker deployment, mobile-friendly.

Oversight: review every PR, and give branch protection a check to require (#159)

Carter5545b4535540
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 81d41fb..4eb5533 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -22,11 +22,14 @@ on:
paths-ignore:
- 'docs/**'
- '**.md'
+ # No paths-ignore on pull_request, deliberately. A workflow skipped at the TRIGGER
+ # leaves its checks Pending forever, and main requires these checks — so a
+ # markdown-only PR would be permanently unmergeable. The `changes` job below already
+ # filters per job, so a docs-only PR still runs nothing but that one cheap job; it just
+ # runs it, and reports the checks as skipped, which counts as passed.
+ # `push` keeps its paths-ignore: no branch protection depends on those runs.
pull_request:
branches: [main]
- paths-ignore:
- - 'docs/**'
- - '**.md'
# Least privilege — nothing in this workflow needs to write via GITHUB_TOKEN (image pushes and
# the Fly deploy use their own secrets). Matches mobile-ci.yml's prior explicit read-only scope,
diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml
new file mode 100644
index 0000000..445431c
--- /dev/null
+++ b/.github/workflows/claude-code-review.yml
@@ -0,0 +1,69 @@
+name: Claude Code Review
+
+# Runs the same `code-review` skill that /code-review runs locally, but on every PR
+# rather than only when someone remembers to ask. Of the six slices split off #150 so far,
+# exactly one got an independent review — and it found a font regression that tsc, lint,
+# three unit suites and the whole of CI had passed.
+#
+# Not the managed Code Review product: that is Team/Enterprise only and bills $15-25 per
+# review as usage credits. This authenticates with a subscription token instead, so review
+# cost comes out of the plan's included usage.
+#
+# Findings are advisory. The action posts inline comments; nothing here gates the merge.
+
+on:
+ pull_request:
+ types: [opened, synchronize, ready_for_review, reopened]
+
+# Least privilege by default, raised only where a job needs it — the pattern oven-sh/bun
+# uses on its Claude workflows.
+permissions:
+ contents: read
+
+jobs:
+ review:
+ # Two guards, both about not starting a runner that cannot do anything useful:
+ # draft - work in progress; the skill skips drafts itself, but not starting the
+ # runner at all is cheaper.
+ # same-repo - this repo is public with 25 forks, and GitHub withholds secrets from
+ # fork pull requests. Without this the job starts, finds an empty
+ # CLAUDE_CODE_OAUTH_TOKEN and fails on auth, putting a red X on an
+ # outside contributor's first PR for something they cannot fix.
+ if: >-
+ github.event.pull_request.draft == false &&
+ github.event.pull_request.head.repo.full_name == github.repository
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+
+ # A rapid re-push should replace the running review, not queue a second one behind it.
+ concurrency:
+ group: claude-review-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+ permissions:
+ contents: read
+ pull-requests: write # write, not read: the review posts inline comments
+ issues: read
+ id-token: write # required for the action's GitHub App authentication
+
+ steps:
+ # Pinned by commit, not by tag: a tag can be moved to point at other code, and this
+ # step runs with a token in the environment.
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ fetch-depth: 1
+ # Don't leave the token in .git/config for later steps to pick up.
+ persist-credentials: false
+
+ - uses: anthropics/claude-code-action@a874e9ecd7bb36efdad65429c6b35815f5a08f10 # v1.0.210
+ with:
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
+ plugin_marketplaces: "https://github.com/anthropics/claude-code.git"
+ plugins: "code-review@claude-code-plugins"
+ prompt: "/code-review:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}"
+ # Both lines below are load-bearing and easy to lose:
+ # --comment : without it the findings go only to the workflow run log
+ # --allowedTools : the action starts the inline-comment MCP server only when
+ # --allowedTools names it, even though the skill's own
+ # frontmatter already declares the same tool
+ claude_args: '--allowedTools "mcp__github_inline_comment__create_inline_comment"'