Skip to content

Commit b904633

Browse files
authored
ci: execute some workflows conditionally (#13165)
* Revert "feat(ci): only markdown action to skip some CI workflows (#13118)" This reverts commit e53768c. * ci: execute some workflows conditionally * ci: fix markdown filters in check * ci: update the workflow ignore conditions
1 parent 7984888 commit b904633

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Build
22

33
on:
44
pull_request:
5+
paths-ignore:
6+
- '**/*.md'
57
push:
68
branches:
79
- master

.github/workflows/check.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,24 @@ permissions:
2020
contents: read
2121

2222
jobs:
23+
pre-check:
24+
name: Check (precheck)
25+
if: ${{ github.event_name == 'pull_request' }}
26+
runs-on: ubuntu-latest
27+
outputs:
28+
skip_checks: ${{ steps.changes.outputs.nonMarkdownFiles == 'false' }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
- id: changes
32+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
33+
with:
34+
filters: |
35+
nonMarkdownFiles:
36+
- '!**/*.md'
2337
check-gen:
2438
name: Check (gen-check)
39+
needs: [pre-check]
40+
if: ${{ needs.pre-check.outputs.skip_checks != 'true' }}
2541
runs-on: ubuntu-latest
2642
steps:
2743
- uses: actions/checkout@v4
@@ -37,6 +53,8 @@ jobs:
3753
- run: git diff --exit-code
3854
check-lint:
3955
name: Check (lint-all)
56+
needs: [pre-check]
57+
if: ${{ needs.pre-check.outputs.skip_checks != 'true' }}
4058
runs-on: ubuntu-latest
4159
steps:
4260
- uses: actions/checkout@v4
@@ -49,6 +67,8 @@ jobs:
4967
- run: make lint
5068
check-fmt:
5169
name: Check (gofmt)
70+
needs: [pre-check]
71+
if: ${{ needs.pre-check.outputs.skip_checks != 'true' }}
5272
runs-on: ubuntu-latest
5373
steps:
5474
- uses: actions/checkout@v4
@@ -60,6 +80,8 @@ jobs:
6080
- run: git diff --exit-code
6181
check-mod-tidy:
6282
name: Check (mod-tidy-check)
83+
needs: [pre-check]
84+
if: ${{ needs.pre-check.outputs.skip_checks != 'true' }}
6385
runs-on: ubuntu-latest
6486
steps:
6587
- uses: actions/checkout@v4
@@ -69,3 +91,17 @@ jobs:
6991
- uses: ./.github/actions/install-go
7092
- run: go mod tidy -v
7193
- run: git diff --exit-code
94+
post-check:
95+
name: Check (postcheck)
96+
needs: [check-gen, check-lint, check-fmt, check-mod-tidy]
97+
if: ${{ !cancelled() }}
98+
runs-on: ubuntu-latest
99+
steps:
100+
- env:
101+
failure: ${{ needs.check-gen.result == 'failure' || needs.check-lint.result == 'failure' || needs.check-fmt.result == 'failure' || needs.check-mod-tidy.result == 'failure' }}
102+
run: |
103+
if [[ "$failure" == "true" ]]; then
104+
echo "Some checks failed, see the workflow results for more information."
105+
exit 1
106+
fi
107+
shell: bash

.github/workflows/docker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
- master
1212
- release/v*
1313
- release/miner/v*
14+
paths-ignore:
15+
- '**/*.md'
1416
schedule:
1517
- cron: '0 0 * * *'
1618
workflow_dispatch:

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Test
22

33
on:
44
pull_request:
5+
paths-ignore:
6+
- '**/*.md'
57
push:
68
branches:
79
- master

0 commit comments

Comments
 (0)