55 branches :
66 - main
77 pull_request :
8- paths :
9- - " .github/workflows/objc-conversion-analysis.yml"
10- - " SwiftConversion/**"
11- - " scripts/ci-diagnostics.sh"
128
139# Concurrency configuration:
1410# - We use workflow-specific concurrency groups to prevent multiple Objective-C conversion analysis runs,
@@ -22,8 +18,25 @@ concurrency:
2218 cancel-in-progress : ${{ github.event_name == 'pull_request' }}
2319
2420jobs :
21+ files-changed :
22+ name : Detect File Changes
23+ runs-on : ubuntu-latest
24+ outputs :
25+ run_objc_conversion_analysis_for_prs : ${{ steps.changes.outputs.run_objc_conversion_analysis_for_prs }}
26+ steps :
27+ - uses : actions/checkout@v5
28+ - name : Get changed files
29+ id : changes
30+ uses : dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
31+ with :
32+ token : ${{ github.token }}
33+ filters : .github/file-filters.yml
34+
2535 analyze-objc-conversion :
2636 name : Analyze Objective-C to Swift Conversion
37+ # Run the job only for PRs with related changes or non-PR events.
38+ if : github.event_name != 'pull_request' || needs.files-changed.outputs.run_objc_conversion_analysis_for_prs == 'true'
39+ needs : files-changed
2740 runs-on : macos-15
2841 timeout-minutes : 10
2942
6881 - name : Run CI Diagnostics
6982 if : failure()
7083 run : ./scripts/ci-diagnostics.sh
84+
85+ # This check validates that either all Objective-C conversion analysis passed or was skipped, which allows us
86+ # to make the analysis a required check with only running the analysis when required.
87+ # So, we don't have to run analysis, for example, for Changelog or ReadMe changes.
88+
89+ objc_conversion_analysis-required-check :
90+ needs :
91+ [
92+ files-changed,
93+ analyze-objc-conversion,
94+ ]
95+ name : Objective-C Conversion Analysis
96+ # This is necessary since a failed/skipped dependent job would cause this job to be skipped
97+ if : always()
98+ runs-on : ubuntu-latest
99+ steps :
100+ # If any jobs we depend on fails gets cancelled or times out, this job will fail.
101+ # Skipped jobs are not considered failures.
102+ - name : Check for failures
103+ if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
104+ run : |
105+ echo "One of the Objective-C conversion analysis jobs has failed." && exit 1
0 commit comments