Skip platform-specific builds based on formula dependencies#2008
Merged
Conversation
Co-authored-by: chenrui333 <[email protected]>
Co-authored-by: chenrui333 <[email protected]>
Copilot
AI
changed the title
[WIP] Fix workflow to skip macOS builds for Linux-only PRs
Skip platform-specific builds based on formula dependencies
Oct 9, 2025
chenrui333
added a commit
that referenced
this pull request
Oct 9, 2025
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.
Problem
When a PR contains formulas with platform-specific dependencies (e.g.,
depends_on :linux), the CI workflow was unnecessarily running builds on all platforms. As shown in the issue screenshot, a PR with the "linux-only" label still triggered all 4 macOS runners (macos-14, macos-15, macos-15-intel, macos-26) even though they would never succeed for a Linux-only formula.This wastes CI resources, increases queue times, and delays feedback for contributors.
Solution
This PR implements intelligent platform filtering in the CI workflow, matching the behavior of
homebrew/homebrew-core:depends_on :linux): Skip all macOS runners, only run Linux buildsdepends_on :macos): Skip all Linux runners, only run macOS buildsImplementation
1. Label Detection (
environment.js)Extended the environment configuration script to detect
linux-onlyandmacos-onlylabels (which are automatically applied by thetriage.ymlworkflow) and set corresponding output flags.2. Conditional Runner Execution (
tests.yml)skip_on_linux_onlyandskip_on_macos_onlyflags to each matrix runnerBenefits
Example
For a PR adding a Linux-only formula:
Before:
After:
Safety
Fixes #[issue_number]
Original prompt
Fixes #2007
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.