Skip to content

Commit bf23fe8

Browse files
authored
use verify changes for docs to skip tests (#21620) (#22017)
* use verify changes for docs to skip tests * add verify-changes to the needed jobs * skip go tests for doc/ui only changes * fix a job ref * change names, remove script * remove ui conditions * separate flags * feedback
1 parent 0e025ed commit bf23fe8

File tree

2 files changed

+17
-43
lines changed

2 files changed

+17
-43
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,7 @@ concurrency:
2121
jobs:
2222
# verify-changes determines if the changes are only for docs (website)
2323
verify-changes:
24-
if: github.event.pull_request.draft == false
25-
runs-on: ubuntu-latest
26-
outputs:
27-
is_docs_change: ${{ steps.get-changeddir.outputs.is_docs_change }}
28-
steps:
29-
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
30-
with:
31-
ref: ${{ github.event.pull_request.head.sha }}
32-
fetch-depth: 0 # Use fetch depth 0 for comparing changes to base branch
33-
- name: Get changed directories
34-
id: get-changeddir
35-
env:
36-
TYPE: ${{ github.event_name }}
37-
REF_NAME: ${{ github.ref_name }}
38-
BASE: ${{ github.base_ref }}
39-
run: ./.github/scripts/verify_changes.sh ${{ env.TYPE }} ${{ env.REF_NAME }} ${{ env.BASE }}
24+
uses: ./.github/workflows/verify_changes.yml
4025

4126
product-metadata:
4227
# do not run build and test steps for docs changes

.github/workflows/ci.yml

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,19 @@ jobs:
9393
run: |
9494
./.github/scripts/oss-diff.sh ${{ steps.determine-branch.outputs.BRANCH }} HEAD
9595
96+
verify-changes:
97+
name: Verify doc-ui only PRs
98+
uses: ./.github/workflows/verify_changes.yml
99+
96100
test-go:
97101
name: Run Go tests
98102
needs:
99103
- setup
100-
# Don't run this job for PR branches starting with:
101-
# 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/'
102-
# OR
103-
# the 'docs' label is present
104+
- verify-changes
105+
# Don't run this job for docs/ui only PRs
104106
if: |
105-
!startsWith(github.head_ref, 'ui/') &&
106-
!startsWith(github.head_ref, 'backport/ui/') &&
107-
!startsWith(github.head_ref, 'docs/') &&
108-
!startsWith(github.head_ref, 'backport/docs/') &&
109-
!contains(github.event.pull_request.labels.*.name, 'docs')
107+
needs.verify-changes.outputs.is_docs_change == 'false' &&
108+
needs.verify-changes.outputs.is_ui_change == 'false'
110109
uses: ./.github/workflows/test-go.yml
111110
with:
112111
# The regular Go tests use an extra runner to execute the
@@ -124,17 +123,12 @@ jobs:
124123
name: Run Go tests with data race detection
125124
needs:
126125
- setup
127-
# Don't run this job for PR branches starting with:
128-
# 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/'
129-
# OR
130-
# the 'docs' label is present
126+
- verify-changes
127+
# Don't run this job for docs/ui only PRs
131128
if: |
132129
github.event.pull_request.draft == false &&
133-
!startsWith(github.head_ref, 'ui/') &&
134-
!startsWith(github.head_ref, 'backport/ui/') &&
135-
!startsWith(github.head_ref, 'docs/') &&
136-
!startsWith(github.head_ref, 'backport/docs/') &&
137-
!contains(github.event.pull_request.labels.*.name, 'docs')
130+
needs.verify-changes.outputs.is_docs_change == 'false' &&
131+
needs.verify-changes.outputs.is_ui_change == 'false'
138132
uses: ./.github/workflows/test-go.yml
139133
with:
140134
total-runners: 16
@@ -152,20 +146,15 @@ jobs:
152146

153147
test-go-fips:
154148
name: Run Go tests with FIPS configuration
155-
# Only run this job for the enterprise repo if the PR branch doesn't start with:
156-
# 'ui/', 'backport/ui/', 'docs/', or 'backport/docs/'
157-
# OR
158-
# the 'docs' label is not present
149+
# Only run this job for the enterprise repo if the PR is not docs/ui only
159150
if: |
160151
github.event.pull_request.draft == false &&
161152
needs.setup.outputs.enterprise == 1 &&
162-
!startsWith(github.head_ref, 'ui/') &&
163-
!startsWith(github.head_ref, 'backport/ui/') &&
164-
!startsWith(github.head_ref, 'docs/') &&
165-
!startsWith(github.head_ref, 'backport/docs/') &&
166-
!contains(github.event.pull_request.labels.*.name, 'docs')
153+
needs.verify-changes.outputs.is_docs_change == 'false' &&
154+
needs.verify-changes.outputs.is_ui_change == 'false'
167155
needs:
168156
- setup
157+
- verify-changes
169158
uses: ./.github/workflows/test-go.yml
170159
with:
171160
total-runners: 16

0 commit comments

Comments
 (0)