4
4
push :
5
5
branches :
6
6
- main
7
- paths :
8
- - " Sources/**"
9
- - " Tests/**"
10
- - " test-server/**"
11
- - " Samples/**"
12
- - " .github/workflows/lint-xcode-analyze.yml"
13
- - " scripts/ci-select-xcode.sh"
14
- - " scripts/ci-diagnostics.sh"
15
-
16
7
pull_request :
17
- paths :
18
- - " Sources/**"
19
- - " Tests/**"
20
- - " test-server/**"
21
- - " Samples/**"
22
- - " .github/workflows/lint-xcode-analyze.yml"
23
- - " scripts/ci-select-xcode.sh"
24
- - " scripts/ci-diagnostics.sh"
25
- - " Sentry.xcodeproj/**"
26
- - " *.podspec"
27
- - " Gemfile.lock"
28
8
29
9
# Concurrency configuration:
30
10
# - We use workflow-specific concurrency groups to prevent multiple lint runs on the same code,
@@ -38,8 +18,25 @@ concurrency:
38
18
cancel-in-progress : ${{ github.event_name == 'pull_request' }}
39
19
40
20
jobs :
21
+ files-changed :
22
+ name : Detect File Changes
23
+ runs-on : ubuntu-latest
24
+ outputs :
25
+ run_lint_xcode_analyze_for_prs : ${{ steps.changes.outputs.run_lint_xcode_analyze_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
+
41
35
lint :
42
36
name : Lint
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_lint_xcode_analyze_for_prs == 'true'
39
+ needs : files-changed
43
40
runs-on : macos-15
44
41
steps :
45
42
- uses : actions/checkout@v5
48
45
- name : Run CI Diagnostics
49
46
if : failure()
50
47
run : ./scripts/ci-diagnostics.sh
48
+
49
+ lint_xcode_analyze-required-check :
50
+ needs :
51
+ [
52
+ files-changed,
53
+ lint,
54
+ ]
55
+ name : Lint Xcode
56
+ # This is necessary since a failed/skipped dependent job would cause this job to be skipped
57
+ if : always()
58
+ runs-on : ubuntu-latest
59
+ steps :
60
+ # If any jobs we depend on fails gets cancelled or times out, this job will fail.
61
+ # Skipped jobs are not considered failures.
62
+ - name : Check for failures
63
+ if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
64
+ run : |
65
+ echo "One of the lint check jobs has failed." && exit 1
0 commit comments