Skip to content

Commit 2173f53

Browse files
EdwardAngertclaude
andcommitted
refactor: improve changed files handling for Vale
- Mimic tj-actions/changed-files output format - Add both comma-separated and space-separated outputs - Better handle empty/null arrays with early exit - Improve readability with more descriptive comments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2acea1b commit 2173f53

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

.github/workflows/docs-unified.yaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,29 @@ jobs:
127127
128128
# Vale style checking for documentation - only checks changed files
129129
# This is the ONLY place Vale is actually run - the action in docs-core is a placeholder
130+
# Extract and format changed files for Vale in a way similar to tj-actions/changed-files
130131
- name: Extract changed files for Vale
131132
id: extract-changed-files
132133
if: steps.docs-core-setup.outputs.needs_vale == 'true' && steps.docs-core-setup.outputs.has_changes == 'true'
133134
shell: bash
134135
run: |
135-
# Use the JSON array of changed files detected by docs-core
136+
# Parse JSON array from docs-core output
136137
CHANGED_FILES_JSON='${{ steps.docs-core-setup.outputs.changed_files }}'
137-
# Convert JSON array to comma-separated list
138-
CHANGED_FILES=$(echo "$CHANGED_FILES_JSON" | jq -r 'join(",")')
139-
if [ -n "$CHANGED_FILES" ] && [ "$CHANGED_FILES" != "null" ]; then
140-
echo "Files to check: $CHANGED_FILES"
141-
echo "files_to_check=$CHANGED_FILES" >> $GITHUB_OUTPUT
142-
else
138+
139+
# Handle empty or null arrays
140+
if [ "$CHANGED_FILES_JSON" == "[]" ] || [ "$CHANGED_FILES_JSON" == "null" ]; then
143141
echo "No files to check"
142+
exit 0
144143
fi
144+
145+
# Extract files as comma-separated string (Vale action input format)
146+
CHANGED_FILES=$(echo "$CHANGED_FILES_JSON" | jq -r 'join(",")')
147+
echo "Files to check: $CHANGED_FILES"
148+
echo "files_to_check=$CHANGED_FILES" >> $GITHUB_OUTPUT
149+
150+
# Create space-separated output as well (like tj-actions/changed-files)
151+
CHANGED_FILES_SPACES=$(echo "$CHANGED_FILES_JSON" | jq -r 'join(" ")')
152+
echo "all_changed_files=$CHANGED_FILES_SPACES" >> $GITHUB_OUTPUT
145153
146154
- name: Run Vale style checks
147155
if: steps.docs-core-setup.outputs.needs_vale == 'true' && steps.extract-changed-files.outputs.files_to_check != ''

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