5
5
branches :
6
6
- main
7
7
pull_request :
8
- paths :
9
- - " .github/workflows/objc-conversion-analysis.yml"
10
- - " SwiftConversion/**"
11
- - " scripts/ci-diagnostics.sh"
12
8
13
9
# Concurrency configuration:
14
10
# - We use workflow-specific concurrency groups to prevent multiple Objective-C conversion analysis runs,
@@ -22,8 +18,25 @@ concurrency:
22
18
cancel-in-progress : ${{ github.event_name == 'pull_request' }}
23
19
24
20
jobs :
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
+
25
35
analyze-objc-conversion :
26
36
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
27
40
runs-on : macos-15
28
41
timeout-minutes : 10
29
42
68
81
- name : Run CI Diagnostics
69
82
if : failure()
70
83
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