chore: ignore non-code files from triggering builds#3176
Merged
Conversation
Contributor
Reviewer's GuideThis PR replaces the previous paths-ignore-based skipping of pull_request workflows with an explicit Detect Changes job that classifies PRs as code vs non-code changes, then conditions all build and screenshot jobs (and their runners) on that result so required checks always report while heavy work is skipped for documentation/media-only PRs. Sequence diagram for PR-triggered CI with Detect Changes gatesequenceDiagram
actor Dev
participant GitHub
participant BuildWorkflow
participant ChangesJob as "changes job"
participant CommonJob as "common job"
participant PlatformJobs as "platform and screenshot jobs"
Dev->>GitHub: Open or update pull request
GitHub->>BuildWorkflow: Trigger pull_request workflow
BuildWorkflow->>ChangesJob: Run Detect Changes job
ChangesJob->>ChangesJob: git diff base_sha head_sha
ChangesJob->>ChangesJob: Filter non-code extensions and docs/
ChangesJob-->>BuildWorkflow: Output is_code true or false
alt is_code == true (code changes)
BuildWorkflow->>CommonJob: Run Common Build job
CommonJob-->>BuildWorkflow: Artifacts and shared setup
BuildWorkflow->>PlatformJobs: Run Android/iOS/desktop builds and screenshots
else is_code != true (non-code changes)
BuildWorkflow->>CommonJob: Job runs but heavy steps are skipped
BuildWorkflow->>PlatformJobs: Run lightweight Non-Code Change steps
end
PlatformJobs-->>GitHub: Report required check statuses
GitHub-->>Dev: Enable Merge button once all checks succeed
Flow diagram for Detect Changes gate logicflowchart TD
Start[Start Detect Changes job]
Checkout[Checkout repository with full history]
Diff[Run git diff --name-only base_sha head_sha]
FilterExt[Filter out non-code extensions md/png/jpg/jpeg/gif/svg/webp/txt/arb]
FilterDocs[Filter out files under docs/]
AnyFiles{Any files left?}
IsCodeTrue[Set is_code output to true]
IsCodeFalse[Set is_code output to false]
End[End Detect Changes job]
Start --> Checkout --> Diff --> FilterExt --> FilterDocs --> AnyFiles
AnyFiles -- Yes --> IsCodeTrue --> End
AnyFiles -- No --> IsCodeFalse --> End
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The repeated
Non-Code Changesteps andif: needs.changes.outputs.is_code == 'true'guards in every job could be simplified by using job-levelif:conditions (e.g. one job for code changes and a lightweight, shared no-op job for non-code PRs), which would reduce duplication and make the workflow easier to maintain. - Instead of dynamically switching
runs-onbetween platform-specific runners andubuntu-latestfor non-code changes, consider using a single appropriate runner per job plus a job-levelifto skip the entire job whenis_codeis false, which keeps the workflow more readable and avoids unnecessary indirection inruns-onexpressions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The repeated `Non-Code Change` steps and `if: needs.changes.outputs.is_code == 'true'` guards in every job could be simplified by using job-level `if:` conditions (e.g. one job for code changes and a lightweight, shared no-op job for non-code PRs), which would reduce duplication and make the workflow easier to maintain.
- Instead of dynamically switching `runs-on` between platform-specific runners and `ubuntu-latest` for non-code changes, consider using a single appropriate runner per job plus a job-level `if` to skip the entire job when `is_code` is false, which keeps the workflow more readable and avoids unnecessary indirection in `runs-on` expressions.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
Build StatusBuild successful. APKs to test: https://github.com/fossasia/pslab-app/actions/runs/24307619242/artifacts/6392925986. Screenshots |
marcnause
approved these changes
Apr 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.







-1_instruments_screen.png?raw=true)
-2_nav_drawer.png?raw=true)
-3_accelerometer.png?raw=true)
-4_power_source.png?raw=true)
-5_multimeter.png?raw=true)
-6_wave_generator.png?raw=true)
-7_oscilloscope.png?raw=true)
Fixes #3168
Changes
Previously,
paths-ignorewas used to skip CI builds for documentation and media files.Since Android and iOS builds are marked as required checks, skipping these jobs meant no status was reported, which blocked the Merge button even for documentation-only PRs.
Solution
Added a Detect Changes gatekeeper job that checks the PR diff.
Instead of skipping the workflow, heavy build/test steps are skipped for non-code changes while still reporting successful CI checks.
How It Works
Detect Changes Logic
The Detect Changes job determines whether a PR contains code changes or only documentation/media files.
Git Diff Check
git diff --name-onlybetween the PR base SHA and head SHA.Filtering Non-Code Files
The file list is filtered using
grep:.md,.png,.jpg,.svg,.txt,.arbdocs/directoryDecision
is_code = true(code changes detected)is_code = false(documentation/media only)CI Workflow Behavior
Doc-only changes
Code changes
Mixed changes
Result
I tested the changes in my fork: rahul31124#35
The CI workflow runs successfully and required checks are reported correctly.
Documentation-only changes now skip heavy build steps while still completing the required CI jobs.
As a result, PR #3150 can now be merged.
Screenshots / Recordings
N/A
Checklist:
constants.dartor localization files instead of hard-coded values.dart formator the IDE formatter.flutter analyzeand tests run influtter test.Summary by Sourcery
Introduce a change-detection gate in the pull request workflow so required CI jobs always report status while heavy build steps are skipped for non-code changes.
Build:
CI:
Summary by Sourcery
Introduce a change-detection gate in the pull request workflow so required CI jobs always report status while heavy platform builds are skipped for non-code changes.
Build:
CI: