Skip to content

MILAB-7348: greptile auto-approve in TypeScript with @actions/glob matching - #247

Merged
DenKoren merged 2 commits into
v4-betafrom
MILAB-7348_greptile-auto-approve-ts
Nov 14, 2026
Merged

DenKoren merged 2 commits into
v4-betafrom
MILAB-7348_greptile-auto-approve-ts

Conversation

@DenKoren

Copy link
Copy Markdown
Member

Rewrites actions/greptile/auto-approve in TypeScript. The protected list now uses the @actions/glob matching rules, and matching is case-insensitive.

Decisions

  • Globber against placeholder files. The globber of @actions/glob finds files on disk only, and has no public "does this path match" call. The action has no checkout, and a PR can delete or rename files, so a checkout would not show all changed paths. The action creates an empty placeholder file for each changed path (and the old path of a renamed file) in a temporary directory and runs the globber there. The internal matcher (@actions/glob/lib/internal-pattern) was rejected: it is not a public API, and 0.7 blocks deep imports.
  • Batches for file/directory conflicts. A rename from a/b to a/b/c gives a path that is a file and a directory at the same time. Such paths go into separate batches, one globber run for each.
  • Case-insensitive. The action changes the patterns and the paths to lowercase before it creates the placeholders, then maps the results back to the PR paths.
  • Fail closed on an incorrect list. A pattern that starts with / or ~, or has a .. segment, protects all paths, dismisses earlier bot approvals and fails the job. With the old bash matcher such a line silently matched nothing.
  • Single node24 step instead of a composite action: the TypeScript code also reads the list from the base commit. node24 because GitHub runners already run node20 actions on node24.
  • Starts from v4. v4 has MILAB-7348: mark a restricted PR with a label, not a banner in the PR body #246 (restricted label instead of the PR body banner) that v4-beta does not have. The first commit takes the action from v4, so this PR also brings v4-beta up to date for this action.

Rule changes for consumers

The old matcher was bash [[ $path == $pattern ]]. With the new rules:

  • * does not match /: *.sh matches only root files, use **/*.sh.
  • A directory name (dir, dir/, dir/*) protects the full directory.
  • ! lines: the last matching line wins.
  • # starts a comment only at the start of a line.

milaboratory/pl must merge milaboratory/pl#2463 before this reaches v4: the current pl list has /platform/pkg/cfg, which the new action rejects. #2463 makes the pl list correct for the old and the new rules.

Tests

  • pnpm exec vitest run in actions/greptile/auto-approve: 39 tests.
  • Dry run of the built lib/index.js against milaboratory/pl#2464 (a test PR that changes platform/model/field_state.go):
    • with the list from main: not approved, incorrect pattern /platform/pkg/cfg, the job fails;
    • with the list from #2463: not approved, PR touches protected path platform/model/field_state.go.

…/glob matching

Match protected paths with the @actions/glob globber against empty placeholder
files, since the action has no checkout and a PR can delete or rename files.
Matching is case-insensitive. An incorrect pattern protects all paths and fails
the job.
@greptile-apps

greptile-apps Bot commented Nov 14, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@notion-workspace

Copy link
Copy Markdown

@DenKoren
DenKoren merged commit 7294314 into v4-beta Nov 14, 2026
1 check 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.

1 participant