Skip to content

Commit 4035be5

Browse files
authored
[chore] add required check (#3608)
1 parent fd23a40 commit 4035be5

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

.asf.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ github:
5050
strict: false
5151
contexts:
5252
- Build Check
53+
- check-md-links
54+
- check-file-sizes
55+
- Build docs-next
5356
features:
5457
issues: true
5558

.github/workflows/docs-next-build.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@ name: docs-next build check
2020

2121
on:
2222
pull_request:
23-
paths:
24-
- 'docs-next/**'
25-
- 'sidebars-next.ts'
26-
- 'next_versions.json'
27-
- 'i18n/zh-CN/docusaurus-plugin-content-docs-next/**'
28-
- 'docusaurus.config.js'
29-
- '.github/workflows/docs-next-build.yml'
23+
types: [opened, synchronize, reopened]
3024

3125
concurrency:
3226
group: ${{ github.ref }} (docs-next build)
@@ -41,26 +35,46 @@ jobs:
4135
uses: actions/checkout@v4
4236
with:
4337
ref: ${{ github.event.pull_request.head.sha }}
44-
fetch-depth: 1
38+
fetch-depth: 0
39+
40+
- name: Detect relevant changes
41+
id: changes
42+
run: |
43+
set -e
44+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
45+
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
46+
CHANGED=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
47+
echo "Changed files:"
48+
echo "$CHANGED"
49+
if echo "$CHANGED" | grep -E '^(docs-next/|sidebars-next\.ts$|next_versions\.json$|i18n/zh-CN/docusaurus-plugin-content-docs-next/|docusaurus\.config\.js$|\.github/workflows/docs-next-build\.yml$)' >/dev/null; then
50+
echo "relevant=true" >> "$GITHUB_OUTPUT"
51+
else
52+
echo "relevant=false" >> "$GITHUB_OUTPUT"
53+
echo "No docs-next-related changes detected; skipping build."
54+
fi
4555
4656
- name: Use Node.js
57+
if: steps.changes.outputs.relevant == 'true'
4758
uses: actions/setup-node@v4
4859
with:
4960
node-version: 20
5061

5162
- name: Install dependencies
63+
if: steps.changes.outputs.relevant == 'true'
5264
run: |
5365
npm install -g yarn
5466
yarn install --frozen-lockfile || yarn install
5567
5668
- name: Build (current only, EN + zh-CN)
69+
if: steps.changes.outputs.relevant == 'true'
5770
env:
5871
DOCS_VERSIONS: current
5972
run: |
6073
export NODE_OPTIONS=--max-old-space-size=8192
6174
yarn docusaurus build --locale en --locale zh-CN
6275
6376
- name: Verify docs-next artifacts
77+
if: steps.changes.outputs.relevant == 'true'
6478
run: |
6579
set -e
6680
test -d build/docs-next/dev

0 commit comments

Comments
 (0)