Skip to content

Conversation

@jackluo923
Copy link
Member

@jackluo923 jackluo923 commented Oct 31, 2025

Description

This PR adds a lightweight build workflow that allows PRs with non-code changes to pass the required "build" check without running the full build and test suite.

Problem

Currently, PRs that only modify documentation files (like README.md or files in docs/) or workflow configurations don't trigger the main build.yaml workflow due to its path filters. However, if branch protection rules require the "build" check to pass, these PRs get stuck waiting indefinitely for a status that never gets reported.

Solution

Create a new workflow (build-lightweight.yaml) that:

  • Triggers only when non-code files are modified:
    • Documentation files: README.md, docs/**/*, *.md
    • The workflow file itself: .github/workflows/build-lightweight.yaml
  • Shares the same workflow name ("build") as the main build workflow to satisfy branch protection requirements
  • Quickly reports success without running expensive build/test steps
  • Uses a distinct concurrency group ("build-lightweight") to prevent conflicts

Technical Details

The workflow uses a hardcoded concurrency group (build-lightweight-${{github.ref}}) instead of ${{github.workflow}} to avoid concurrency conflicts. Without this, both the main build and lightweight workflows would share the same concurrency group (both resolve to "build") when a PR contains mixed changes (docs + code), potentially causing one workflow to cancel the other with cancel-in-progress: true.

Behavior

  • Non-code changes only: lightweight workflow runs quickly and reports success
  • Code changes only: main build workflow runs with full tests
  • Mixed changes: both workflows run independently without interfering

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • Verified the workflow YAML syntax is valid
  • Confirmed path filters target appropriate non-code files (documentation and workflow itself)
  • Tested that the concurrency group name is unique to prevent conflicts with the main build workflow
  • Validated that using the same workflow name ("build") allows both workflows to satisfy branch protection requirements

Summary by CodeRabbit

  • Chores
    • Enhanced build workflow with intelligent change detection to optimize pull request and deployment processes.

@jackluo923 jackluo923 requested a review from a team as a code owner October 31, 2025 19:12
@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Walkthrough

A new GitHub Actions workflow file is introduced to skip build jobs when only non-code files (documentation, README, workflow configuration) are modified in pull requests or pushes.

Changes

Cohort / File(s) Summary
New GitHub Actions workflow
​.github/workflows/build-lightweight.yaml
Adds a workflow that triggers on PRs and pushes affecting specific paths (workflow itself, README, docs, Markdown files). Includes a concurrency group with in-progress run cancellation. Contains a single "build" job on Ubuntu that detects non-code changes and outputs a skip message.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "ci: Add build workflow for documentation-only changes" accurately and directly describes the main purpose of this pull request. It clearly communicates that the PR introduces a new CI workflow specifically designed to handle documentation-only changes, which aligns with the PR objectives of allowing documentation-only pull requests to satisfy the repository's required "build" check without running the full test suite. The title is concise, specific, and avoids vague terminology, making it clear to anyone reviewing the git history what this change accomplishes.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2392e59 and 1ba2df7.

📒 Files selected for processing (1)
  • .github/workflows/build-lightweight.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: jackluo923
Repo: y-scope/log-surgeon PR: 174
File: .github/workflows/build-docs-only.yaml:19-24
Timestamp: 2025-10-31T19:29:43.476Z
Learning: In GitHub Actions workflows, using the same workflow name (e.g., `name: "build"`) across multiple workflow files with mutually exclusive path filters is a valid pattern. This allows any of the workflows to satisfy a single branch protection status check requirement, avoiding the need to configure multiple status check names in branch protection rules.
📚 Learning: 2025-10-31T19:29:43.476Z
Learnt from: jackluo923
Repo: y-scope/log-surgeon PR: 174
File: .github/workflows/build-docs-only.yaml:19-24
Timestamp: 2025-10-31T19:29:43.476Z
Learning: In GitHub Actions workflows, using the same workflow name (e.g., `name: "build"`) across multiple workflow files with mutually exclusive path filters is a valid pattern. This allows any of the workflows to satisfy a single branch protection status check requirement, avoiding the need to configure multiple status check names in branch protection rules.

Applied to files:

  • .github/workflows/build-lightweight.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: lint (ubuntu-24.04)
🔇 Additional comments (4)
.github/workflows/build-lightweight.yaml (4)

1-1: Verify filename alignment with design intent.

The file is named build-lightweight.yaml, but the PR objectives mention build-docs-only.yaml. The concurrency group uses "build-lightweight" as well. Please confirm:

  1. Is the filename/identifier intentionally renamed from the original design?
  2. Should other references (concurrency group, etc.) be updated to match if this is the final naming?

Also applies to: 6-6, 12-12


17-19: Clarify concurrency group design: hardcoded vs. parameterized.

The PR objectives state: "uses a hardcoded concurrency group ('build-docs-only') instead of ${{github.workflow}}" to avoid cancellation conflicts with mixed PR changes. However, the implementation uses "build-lightweight-${{github.ref}}", which includes parameterization.

Per the design intent, should the concurrency group be fully hardcoded (e.g., "build-lightweight") or does the ${{github.ref}} parameterization serve a different purpose that differs from the stated design?

Proposed change if hardcoding is correct:

 concurrency:
-  group: "build-lightweight-${{github.ref}}"
+  group: "build-lightweight"
   cancel-in-progress: true

3-15: Path filter configuration looks correct.

The trigger paths correctly isolate documentation-only changes (README.md, docs/**, *.md, plus the workflow file itself). This ensures the workflow only runs when no source code is modified.


21-26: Workflow logic is appropriate for lightweight execution.

The single job with an echo step efficiently satisfies the branch protection check without running expensive build/test operations. The step completes successfully, which is what matters for the required status check.

One minor note: The message "skipping build" is accurate in intent (the full build is being skipped in favor of this lightweight check), though technically the build job itself is still running—just with minimal overhead.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 840f262 and 2392e59.

📒 Files selected for processing (1)
  • .github/workflows/build-docs-only.yaml (1 hunks)
🔇 Additional comments (2)
.github/workflows/build-docs-only.yaml (2)

15-17: Concurrency group design supports mixed-PR scenarios correctly.

The concurrency group "build-docs-only-${{github.ref}}" is well-designed:

  • The hardcoded "build-docs-only" prefix ensures this workflow has its own concurrency namespace
  • Including ${{github.ref}} prevents interference across different branches/PRs
  • This allows the main build workflow (which likely has a different concurrency group) to run independently when a PR contains both code and documentation changes

This aligns with the PR objectives for mixed-PR scenarios.


3-13: Path filtering is appropriate; only README.md exists at repository root.

Verification confirms the workflow's path patterns are suitable. The repository contains only README.md at the root, which is a standard documentation file. The patterns—README.md, docs/**/*, and *.md—appropriately target documentation without unintended side effects.

Comment on lines 19 to 24
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Documentation-only changes"
run: echo "Only documentation changed, skipping build"
Copy link

@coderabbitai coderabbitai bot Oct 31, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the workflow meets branch protection and status check requirements.

The workflow satisfies the basic requirement of being a GitHub Actions job that can fulfill a branch protection "build" check. However, you should verify:

  1. Status check naming: Confirm that the branch protection rule is configured to accept the status check generated by this workflow (typically build / build)
  2. Integration with main build workflow: Ensure the main build workflow does not have conflicting path filtering that would cause both workflows to run on every code change
  3. Mutual exclusivity: Verify that in doc-only PRs, only this workflow triggers (main workflow should be skipped), and in code-only PRs, only the main workflow triggers

Run the following to check the main build workflow configuration and confirm path filtering is mutually exclusive:


🏁 Script executed:

#!/bin/bash
# Find the main build workflow file
fd -type f -name "*.yaml" -o -name "*.yml" .github/workflows/ |
  xargs grep -l 'name:.*build' |
  grep -v build-docs-only

Length of output: 170


I need to correct the script syntax and re-examine the workflow files. Let me regenerate the verification with proper command syntax:




---

🏁 Script executed:

```shell
#!/bin/bash
# Find all workflow files and search for build workflows (excluding build-docs-only)
find .github/workflows/ -type f \( -name "*.yaml" -o -name "*.yml" \) |
  xargs grep -l "name:.*build" |
  grep -v build-docs-only

Length of output: 28


🏁 Script executed:

#!/bin/bash
# Also examine the build-docs-only workflow to understand its path filtering
cat .github/workflows/build-docs-only.yaml

Length of output: 418


🏁 Script executed:

#!/bin/bash
# Look for all workflows with path filtering configuration
find .github/workflows/ -type f \( -name "*.yaml" -o -name "*.yml" \) -exec grep -l "paths:" {} \;

Length of output: 67



---

🏁 Script executed:

```shell
#!/bin/bash
# Examine the main build workflow
cat .github/workflows/build.yaml

Length of output: 1825


Status check naming conflict: both workflows are named "build".

The path filtering is properly configured and mutually exclusive—build-docs-only.yaml triggers only on documentation changes (README.md, docs/, *.md), while build.yaml triggers only on code changes (src/, tests/, examples/, etc.). However, both workflows have name: "build", which means both generate the same status check: build / build. This creates ambiguity for branch protection rules.

Action required: Rename build-docs-only.yaml to use a distinct workflow name (e.g., name: "build-docs"). This ensures each workflow produces a unique status check name, preventing conflicts and allowing branch protection rules to reference the correct check unambiguously.

🤖 Prompt for AI Agents
.github/workflows/build-docs-only.yaml around lines 19 to 24: both workflows are
named "build" causing duplicate status check names; change the workflow name in
this file from "build" to a distinct name such as "build-docs" so it emits a
unique status check (update the top-level name field accordingly), commit the
change and push so branch protection can reference the correct check.

Copy link
Member Author

Choose a reason for hiding this comment

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

The shared workflow name is intentional, not a conflict. This is a common pattern to satisfy branch protection when using path-based workflow triggers. The goal is for either workflow to fulfill the "build" check requirement depending on which files are modified, without requiring branch protection rules to track multiple check names.

Copy link

Choose a reason for hiding this comment

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

@jackluo923, thank you for the clarification! You're absolutely right—using the same workflow name across path-filtered workflows is a valid and common pattern to satisfy branch protection requirements. This design allows either workflow to fulfill the single "build" status check depending on which files are modified, eliminating the need to configure multiple status checks in branch protection rules. I appreciate you explaining the intentional design.


✏️ Learnings added
Learnt from: jackluo923
Repo: y-scope/log-surgeon PR: 174
File: .github/workflows/build-docs-only.yaml:19-24
Timestamp: 2025-10-31T19:29:43.476Z
Learning: In GitHub Actions workflows, using the same workflow name (e.g., `name: "build"`) across multiple workflow files with mutually exclusive path filters is a valid pattern. This allows any of the workflows to satisfy a single branch protection status check requirement, avoiding the need to configure multiple status check names in branch protection rules.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Create a lightweight build workflow that reports success for PRs that
only modify documentation files (README.md, docs/**/*) or the workflow
file itself. This allows these PRs to pass the required "build" check
without running the full build and test suite, while code changes still
trigger the complete build process.

The workflow shares the same name ("build") as the main build workflow
to satisfy branch protection requirements, but uses a distinct
concurrency group ("build-lightweight") instead of the default
`${{github.workflow}}` to prevent concurrency conflicts. Without this,
both workflows would share the same group and could cancel each other
when a PR contains mixed documentation and code changes.
@jackluo923 jackluo923 force-pushed the ci-enable-doc-only-build branch from 2392e59 to 1ba2df7 Compare October 31, 2025 19:33
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