Skip to content

Commit 0ede342

Browse files
authored
chore(ci): Add required checks job for objc-conversion-analysis.yml (#5998)
1 parent 3cdbc22 commit 0ede342

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

.github/file-filters.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ run_api_stability_for_prs: &run_api_stability_for_prs # API-related code
6565
- "sdk_api.json"
6666
- "sdk_api_v9.json"
6767

68+
run_objc_conversion_analysis_for_prs: &run_objc_conversion_analysis_for_prs
69+
- "SwiftConversion/**"
70+
71+
# GH Actions
72+
- ".github/workflows/objc-conversion-analysis.yml"
73+
- ".github/file-filters.yml"
74+
75+
# Scripts
76+
- "scripts/ci-diagnostics.sh"
77+
6878
run_auto_update_tools_for_prs: &run_auto_update_tools_for_prs # Auto-update tools workflow
6979
# Formatting
7080
- ".pre-commit-config.yaml"

.github/workflows/objc-conversion-analysis.yml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
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

2420
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+
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

@@ -68,3 +81,25 @@ jobs:
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

Comments
 (0)