Skip to content

Commit 20dd834

Browse files
ci: only run operations-gen ci when needed (#909)
Optimize the lint and test for operations-gen to only run when operations-gen is modified
1 parent 87494de commit 20dd834

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

.github/workflows/pull-request-main.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ on:
77
- main
88

99
jobs:
10+
changes:
11+
name: Detect changed files
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: read
16+
outputs:
17+
operations_gen: ${{ steps.filter.outputs.operations_gen }}
18+
steps:
19+
- uses: actions/checkout@v6
20+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
21+
id: filter
22+
with:
23+
filters: |
24+
operations_gen:
25+
- 'tools/operations-gen/**'
26+
1027
ci-lint:
1128
name: Lint
1229
runs-on: ubuntu-latest
@@ -23,6 +40,8 @@ jobs:
2340

2441
ci-lint-operations-gen:
2542
name: Lint operations-gen
43+
needs: [changes]
44+
if: needs.changes.outputs.operations_gen == 'true'
2645
runs-on: ubuntu-latest
2746
permissions:
2847
id-token: write
@@ -47,6 +66,8 @@ jobs:
4766

4867
ci-test-operations-gen:
4968
name: Tests operations-gen
69+
needs: [changes]
70+
if: needs.changes.outputs.operations_gen == 'true'
5071
runs-on: ubuntu-latest
5172
timeout-minutes: 5
5273
permissions:
@@ -248,7 +269,11 @@ jobs:
248269

249270
sonarqube:
250271
name: Sonar Scan
251-
if: github.event_name == 'pull_request'
272+
if: |
273+
always() &&
274+
github.event_name == 'pull_request' &&
275+
!contains(needs.*.result, 'failure') &&
276+
!contains(needs.*.result, 'cancelled')
252277
runs-on: ubuntu-24.04
253278
needs: [ci-test, ci-test-operations-gen, ci-test-provider-aptos, ci-test-provider-canton, ci-test-provider-ton, ci-test-provider-tron, ci-test-provider-stellar, ci-test-provider-fast, ci-test-catalog-remote, ci-lint-misc, ci-lint, ci-lint-operations-gen]
254279
permissions:

0 commit comments

Comments
 (0)