Skip to content

Add claude-review-toolkit composite action#62

Merged
rlinoz merged 3 commits into
Expensify:mainfrom
kacper-mikolajczak:add-claude-review-toolkit-action
May 18, 2026
Merged

Add claude-review-toolkit composite action#62
rlinoz merged 3 commits into
Expensify:mainfrom
kacper-mikolajczak:add-claude-review-toolkit-action

Conversation

@kacper-mikolajczak
Copy link
Copy Markdown
Contributor

@kacper-mikolajczak kacper-mikolajczak commented May 12, 2026

Details

Introduces a shared composite action claude-review-toolkit that consolidates Claude PR review scaffolding currently duplicated across three client repos (Expensify/App, Expensify/Auth, Expensify/Web-Expensify).

Ships:

  • addPrReaction.sh / removePrReaction.sh - strict-validation reaction helpers (PR_NUMBER must be numeric; REACTION must be one of +1, -1, laugh, confused, heart, hooray, rocket, eyes)
  • createInlineComment.sh - posts an inline PR comment; when ALLOWED_RULES_FILE is set and non-empty, enforces a per-comment rule-ID gate; otherwise skips validation
  • extractAllowedRules.sh - walks a rules directory and writes a deduplicated allowlist
  • schemas/code-review-output.json - canonical violations-only schema for the reviewer agent output

Inputs:

  • enforce_allowed_rules (default false) - when true, runs the extractor against the caller's .claude/skills/coding-standards/rules/ and exports ALLOWED_RULES_FILE for downstream steps

Outputs:

  • schema_path, schema_json for direct consumption by anthropics/claude-code-action --json-schema

Side effects: prepends scripts/ to GITHUB_PATH.

This is slice 1 of a three-slice plan. Future slices will share the workflow shape (cross-repo reusable workflow) and base reviewer prompts.

Related Issues

https://github.com/Expensify/Expensify/issues/635397

Manual Tests

Tested by consumer-side draft PRs against this branch's SHA:

Consumer PRs reference this action by placeholder SHA and will be retargeted to the merged-main SHA before going green.

Linked PRs

Listed under Manual Tests above.


cc @Julesssss

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@kacper-mikolajczak
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@kacper-mikolajczak
Copy link
Copy Markdown
Contributor Author

kacper-mikolajczak commented May 12, 2026

CC @Julesssss @rlinoz

exfy-clabot Bot added a commit to Expensify/CLA that referenced this pull request May 12, 2026
Copy link
Copy Markdown
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this refactor!

readonly BODY_ARG="${2:-}"
readonly LINE_ARG="${3:-}"

[[ -z "${PR_NUMBER:-}" ]] && die "Environment variable PR_NUMBER is required"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we know that PR will always exist and we're only running this action against PRs, but as a small improvement could we make createInlineComment.sh take PR_NUMBER as param $1, to match the other scripts. It might help us flag a problem sooner if for example the PR param in /App gets changed to PR_NUMBER_APP.

We already have to update the 3 repos calling this but we're doing that anyway.

Julesssss
Julesssss previously approved these changes May 12, 2026
Copy link
Copy Markdown
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I think we can get this open for review. One other thing to improve would be a readme in this action dir or somewhere else explaining what the missingQueryTimings and enforce_allowed_rules options do and why we need them

@kacper-mikolajczak
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@kacper-mikolajczak
Copy link
Copy Markdown
Contributor Author

@Julesssss Thanks for the feedback - I addressed that ✅

As a second thought we could drop enforce_allowed_rules option entirely and enforce allowed rules on all the repos by default. It's purpose is to prevent reviewer posting comments that are not referencing any of the rules.

I will add this feature preemptively implement that and based on your decision we can either ship it as-is or simply remove commits. Let me know what you think, thanks!

Copy link
Copy Markdown
Contributor

@rlinoz rlinoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this!

@Julesssss
Copy link
Copy Markdown
Contributor

Julesssss commented May 14, 2026

It's purpose is to prevent reviewer posting comments that are not referencing any of the rules.

I thought that might be on purpose due to App repo being open source. Lets not worry about doing alignment for now.

So I see thew Web-E PR ready but I assume we need to merge this PR first? Can this come out of draft now?

@Julesssss
Copy link
Copy Markdown
Contributor

As a second thought we could drop enforce_allowed_rules option entirely and enforce allowed rules on all the repos by default

Ah I see, that's also fine with me 👍

@Julesssss Julesssss marked this pull request as ready for review May 15, 2026 16:34
@Julesssss
Copy link
Copy Markdown
Contributor

Ah I can't merge because one of the initial comms was somehow unverified 😢 could you fix that please Kacper, opening a fresh PR might be the simplest solution.

Screenshot 2026-05-15 at 09 35 37

Introduces a shared composite action that consolidates the duplicated
Claude PR review scaffolding currently maintained in three client repos
(Expensify/App, Expensify/Auth, Expensify/Web-Expensify).

The action ships:
- addPrReaction.sh / removePrReaction.sh - strict-validation reaction
  helpers (PR_NUMBER must be numeric, REACTION must be one of the eight
  GitHub-supported values).
- createInlineComment.sh - posts an inline PR comment; when
  ALLOWED_RULES_FILE is set and non-empty, enforces a per-comment rule-ID
  gate against the allowlist; otherwise skips validation.
- extractAllowedRules.sh - walks a rules directory and writes a sorted,
  deduplicated allowlist of rule IDs.
- schemas/code-review-output.json - canonical violations-only schema for
  the code-inline-reviewer agent output.

The action prepends scripts/ to GITHUB_PATH, exposes schema_path and a
compacted schema_json output for direct consumption by
anthropics/claude-code-action, and (when enforce_allowed_rules=true)
extracts the caller's rule allowlist and exports ALLOWED_RULES_FILE for
downstream steps.
createInlineComment.sh now matches addPrReaction.sh/removePrReaction.sh
by accepting PR_NUMBER as $1 instead of reading it from env. Surfaces
mismatches at the caller (e.g. a renamed PR_NUMBER_APP env var) instead
of silently failing later.

Adds README.md documenting the action's inputs, outputs, and the four
scripts on PATH. Clarifies that schema extensions (Auth's
missingQueryTimings) live in the caller's workflow, not in the toolkit.
The opt-in toggle was leftover from migration. All three consumer repos
(App, Auth, Web-Expensify) already ship a .claude/skills/coding-standards/rules/
directory with valid ruleId frontmatter, and their reviewer agents already
mandate one Rule ID per inline comment. Making the gate universal removes
configuration drift and matches the toolkit's stated purpose of shipping
the strictest version of each script.

- action.yml: drop inputs.enforce_allowed_rules; always run the extract step
- createInlineComment.sh: require ALLOWED_RULES_FILE; remove the skip branch
- README: align with the new always-on behavior

Caller workflows that previously passed enforce_allowed_rules: 'true' can
drop that with: block; callers that did not opt in inherit the gate.
@kacper-mikolajczak kacper-mikolajczak force-pushed the add-claude-review-toolkit-action branch from 6ad2355 to 1f41026 Compare May 18, 2026 07:46
@kacper-mikolajczak
Copy link
Copy Markdown
Contributor Author

kacper-mikolajczak commented May 18, 2026

@Julesssss Re-signed the commits to fix the unverified-commit blocker - PR should be mergeable now. Kept the enforce_allowed_rules drop in, so the gate is universal.

Ready to merge whenever you are - this should unblock PRs on Web-E, App and Auth waiting on the SHA stamp.

@kacper-mikolajczak
Copy link
Copy Markdown
Contributor Author

CC @rlinoz too, so might push it forward before Jules' timezone hits working hours ❤️

@rlinoz
Copy link
Copy Markdown
Contributor

rlinoz commented May 18, 2026

ah nice, thank you!

@rlinoz rlinoz merged commit 43c1b43 into Expensify:main May 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants