Skip to content

Limit Vale CI to PR diff only#2572

Merged
ctauchen merged 2 commits intotigera:mainfrom
ctauchen:vale-diff-only
Mar 6, 2026
Merged

Limit Vale CI to PR diff only#2572
ctauchen merged 2 commits intotigera:mainfrom
ctauchen:vale-diff-only

Conversation

@ctauchen
Copy link
Collaborator

@ctauchen ctauchen commented Mar 6, 2026

Summary

  • Vale was scanning the entire repo on every PR, taking ~10 minutes
  • Now computes changed .md/.mdx files from the PR diff and passes only those to Vale
  • Skips all steps entirely if no markdown files changed

Test plan

  • Open a PR that changes a few markdown files — verify Vale runs quickly and only reports on those files
  • Open a PR with no markdown changes — verify the job skips gracefully

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ctauchen ctauchen requested a review from a team as a code owner March 6, 2026 16:27
Copilot AI review requested due to automatic review settings March 6, 2026 16:27
@netlify
Copy link

netlify bot commented Mar 6, 2026

Deploy Preview for calico-docs-preview-next ready!

Name Link
🔨 Latest commit 7bc84e1
🔍 Latest deploy log https://app.netlify.com/projects/calico-docs-preview-next/deploys/69ab0a6c05dc330008af3c06
😎 Deploy Preview https://deploy-preview-2572--calico-docs-preview-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Mar 6, 2026

Deploy Preview succeeded!

Built without sensitive environment variables

Name Link
🔨 Latest commit 7bc84e1
🔍 Latest deploy log https://app.netlify.com/projects/tigera/deploys/69ab0a6c8ce5d10008bc61e6
😎 Deploy Preview https://deploy-preview-2572--tigera.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 68 (no change from production)
Accessibility: 98 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Vale GitHub Actions workflow to lint only Markdown/MDX files changed in a pull request (instead of scanning the entire repository), aiming to significantly reduce CI runtime.

Changes:

  • Fetch full git history and compute changed .md/.mdx files from the PR commit range.
  • Gate Node/Yarn/Vale steps behind a “skip” output when no markdown files changed.
  • Pass the computed changed-file list to errata-ai/vale-action@reviewdog.

- name: Get changed files
id: changed
run: |
FILES=$(git diff --name-only --diff-filter=d ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- '*.md' '*.mdx' | tr '\n' ' ')
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

git diff is comparing ${{ github.event.pull_request.base.sha }} to ${{ github.event.pull_request.head.sha }} with a two-dot range. If the PR branch is behind the base branch, this will include changes that exist only on the base branch (not introduced by the PR), causing Vale to lint unrelated files and potentially report unrelated issues. Use a merge-base comparison (e.g., the three-dot range) so only changes introduced by the PR are included.

Suggested change
FILES=$(git diff --name-only --diff-filter=d ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- '*.md' '*.mdx' | tr '\n' ' ')
FILES=$(git diff --name-only --diff-filter=d ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} -- '*.md' '*.mdx' | tr '\n' ' ')

Copilot uses AI. Check for mistakes.
if: steps.changed.outputs.skip == 'false'
run: |
sudo apt-get install ripgrep
rg -l0 '\$\[[^\]]*\]' -g '*.mdx' -g '*.md' . | xargs -0 perl -i -pe 's/\$\[[^\]]*\]/PICKLEVAR/g'
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

The "Swap stuff" step still runs rg ... . across the whole repository. This can be a significant portion of the runtime and undermines the goal of limiting Vale CI to the PR diff. Consider restricting the search/replace to the changed markdown files list (and skipping entirely when that list is empty), rather than scanning ..

Suggested change
rg -l0 '\$\[[^\]]*\]' -g '*.mdx' -g '*.md' . | xargs -0 perl -i -pe 's/\$\[[^\]]*\]/PICKLEVAR/g'
FILES="${{ steps.changed.outputs.files }}"
if [ -n "$FILES" ]; then
rg -l0 '\$\[[^\]]*\]' -g '*.mdx' -g '*.md' -- $FILES | xargs -0 perl -i -pe 's/\$\[[^\]]*\]/PICKLEVAR/g'
fi

Copilot uses AI. Check for mistakes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ctauchen ctauchen merged commit d1f72ba into tigera:main Mar 6, 2026
9 of 11 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.

2 participants