Skip to content

fix(ci): handle content guard diffs above 300 files - #2634

Closed
kushagrasarathe wants to merge 1 commit into
mainfrom
fix/ci-content-automerge-large-pr
Closed

fix(ci): handle content guard diffs above 300 files#2634
kushagrasarathe wants to merge 1 commit into
mainfrom
fix/ci-content-automerge-large-pr

Conversation

@kushagrasarathe

@kushagrasarathe kushagrasarathe commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Root cause

gh pr diff --name-only returns HTTP 406 for pull requests with more than 300 files. Under set -e, that harmless non-content PR becomes a false-red approve-and-merge check.

Fix

Use GitHubs paginated pull-request Files API. The guard still auto-merges only when the complete file list is exactly src/content.

Verification

Summary by CodeRabbit

  • Bug Fixes
    • Improved automated content-only change detection for large pull requests.
    • Ensured validation continues to require exactly one eligible file change.

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
peanut-wallet Ready Ready Preview Aug 7, 2026 10:54am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The content publish automerge workflow now retrieves all pull-request filenames through the paginated GitHub Files API before applying the existing exact src/content guard.

Changes

Content file detection

Layer / File(s) Summary
Paginated changed-file detection
.github/workflows/content-publish-automerge.yml
The workflow replaces gh pr diff --name-only with paginated Files API retrieval and keeps the exact single-file content guard.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: hugo0

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the CI fix for content guard diffs that exceed 300 files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-content-automerge-large-pr

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 6352.71 → 6352.71 (0)
Findings: 0 net (+0 new, -0 resolved)

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 2370 ran, 0 failed, 0 skipped, 30.0s

📊 Coverage (unit)

metric %
statements 63.2%
branches 47.0%
functions 53.0%
lines 63.6%
⏱ 10 slowest test cases
time test
2.7s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › never places two stickers in heavy overlap (broad seed sweep)
0.8s src/utils/__tests__/demo-api.test.ts › isDemoMode() is false when not running under Capacitor
0.3s src/app/(mobile-ui)/withdraw/__tests__/withdraw-states.test.tsx › Bank withdrawal keeps the $1 minimum for sub-$1 amounts
0.3s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › every sticker stays within canvas at any count
0.3s src/app/actions/__tests__/api-headers.test.ts › should include Content-Type in validateInviteCode
0.2s src/app/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in validateInviteCode body
0.2s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid 9-digit US account
0.1s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › keeps stickers off the username pill (final pass respects the keep-out)
0.1s src/utils/__tests__/demo-balance.test.ts › auto-refills a stored balance that has no timestamp (legacy install)
0.1s src/utils/__tests__/demo-balance.test.ts › debits and floors at zero
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
.github/workflows/content-publish-automerge.yml (1)

67-67: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Request the maximum page size.

The Files API returns 30 files per page by default and accepts up to 100. For a 759-file pull request, per_page=100 reduces the requests from 26 to 8. This lowers latency and API rate-limit usage while preserving --paginate. (docs.github.com)

Suggested change
-                  FILES=$(gh api --paginate "repos/$REPO/pulls/$PR/files" --jq '.[].filename')
+                  FILES=$(gh api --paginate "repos/$REPO/pulls/$PR/files?per_page=100" --jq '.[].filename')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/content-publish-automerge.yml at line 67, Update the gh
api invocation assigned to FILES to request the maximum supported page size by
adding per_page=100 to the pulls files endpoint, while preserving the existing
--paginate behavior and filename jq filter.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/content-publish-automerge.yml:
- Line 67: Update the gh api invocation assigned to FILES to request the maximum
supported page size by adding per_page=100 to the pulls files endpoint, while
preserving the existing --paginate behavior and filename jq filter.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1f3938d9-9a2e-4f79-815b-813b6ca9dd3a

📥 Commits

Reviewing files that changed from the base of the PR and between 4277703 and 7989de8.

📒 Files selected for processing (1)
  • .github/workflows/content-publish-automerge.yml

@kushagrasarathe

Copy link
Copy Markdown
Contributor Author

Superseded by #2636, which combines this change with the Capgo workflow fix and targets dev.

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