Skip to content

Commit 6420b3f

Browse files
committed
Optimize workflow logic and improve Vale style checking
- Move Vale installation to docs-setup action for better reusability - Remove duplicate Vale installation step from shared action - Add empty file check to Vale style checking for robustness - Update workflow to conditionally install Vale based on input parameter - Make Vale configuration more explicit with improved comments - Ensure consistent use of pre-processed file lists
1 parent 992c592 commit 6420b3f

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

.github/docs/actions/docs-setup/action.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
description: 'Git fetch depth'
1212
required: false
1313
default: '0'
14+
setup-vale:
15+
description: 'Whether to setup Vale for style checking'
16+
required: false
17+
default: 'true'
1418

1519
runs:
1620
using: 'composite'
@@ -33,4 +37,11 @@ runs:
3337

3438
- name: Install dependencies
3539
shell: bash
36-
run: ./scripts/pnpm_install.sh
40+
run: ./scripts/pnpm_install.sh
41+
42+
- name: Install Vale
43+
if: inputs.setup-vale == 'true'
44+
uses: errata-ai/vale-action@v2
45+
with:
46+
config: .github/docs/vale/.vale.ini
47+
files: "" # Don't run Vale yet, just install it

.github/docs/actions/docs-shared/action.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,18 +309,20 @@ runs:
309309
fail_on_error: ${{ inputs.fail-on-error }}
310310
filter_mode: "nofilter"
311311

312-
- name: Install Vale
313-
if: inputs.lint-vale == 'true' && steps.docs-analysis.outputs.has_changes == 'true'
314-
uses: errata-ai/vale-action@v2
315-
with:
316-
config: .github/docs/vale/.vale.ini
317-
318312
- name: Run Vale style checks
319313
if: inputs.lint-vale == 'true' && steps.docs-analysis.outputs.has_changes == 'true'
320314
id: lint-vale
321315
shell: bash
322316
run: |
317+
# Run Vale on changed markdown files using our pre-processed list
318+
# First check if we have any markdown files to process
319+
if [ -z "${{ steps.process-files.outputs.md_files_line }}" ]; then
320+
echo "No markdown files to check"
321+
exit 0
322+
fi
323+
323324
# Run Vale on changed files and capture output
325+
# Use xargs with -r to skip execution if no files are provided
324326
vale_output=$(echo "${{ steps.process-files.outputs.md_files_line }}" | xargs -r vale --config=.github/docs/vale/.vale.ini --output=line 2>&1) || true
325327
326328
echo "result<<EOF" >> $GITHUB_OUTPUT

.github/workflows/docs-unified.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858

5959
- name: Setup Environment
6060
uses: ./.github/docs/actions/docs-setup
61+
with:
62+
setup-vale: ${{ inputs.lint-vale }}
6163

6264
- name: Get PR info
6365
id: pr_info

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy