Skip to content

Commit 6d06909

Browse files
EdwardAngertclaude
andcommitted
fix: add robust Vale installation process for style checking
- Add explicit Vale installation steps - Check multiple installation methods (existing, Homebrew, direct download) - Verify Vale functionality before proceeding with validation - Fix 'command not found' error during Vale style checking 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 815a74d commit 6d06909

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed

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

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,9 +709,55 @@ runs:
709709
run: |
710710
echo "::group::Vale style checking"
711711
712-
# Make sure Vale is installed
713-
if ! command -v vale &> /dev/null; then
714-
echo "Vale not found. Skipping style checks."
712+
# Explicitly install Vale if needed
713+
echo "Installing Vale for style checking..."
714+
VALE_INSTALLED=false
715+
716+
# First try using the existing vale command if available
717+
if command -v vale &> /dev/null; then
718+
echo "Vale already installed"
719+
VALE_INSTALLED=true
720+
else
721+
# On Ubuntu, try to use pre-installed vale or install it
722+
if [ -f "/usr/local/bin/vale" ]; then
723+
echo "Found Vale in /usr/local/bin/"
724+
export PATH="/usr/local/bin:$PATH"
725+
VALE_INSTALLED=true
726+
else
727+
# Try to install Vale using available package managers
728+
if command -v brew &> /dev/null; then
729+
echo "Installing Vale using Homebrew..."
730+
brew install vale
731+
VALE_INSTALLED=true
732+
elif command -v apt-get &> /dev/null; then
733+
echo "Installing Vale using apt..."
734+
# Download and install the latest version
735+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
736+
ARCH=$(uname -m)
737+
if [ "$ARCH" = "x86_64" ]; then
738+
ARCH="64-bit"
739+
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
740+
ARCH="arm64"
741+
fi
742+
743+
LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/errata-ai/vale/releases/latest | grep "browser_download_url.*${OS}_${ARCH}.tar.gz" | cut -d '"' -f 4)
744+
if [ -n "$LATEST_RELEASE_URL" ]; then
745+
echo "Downloading Vale from $LATEST_RELEASE_URL"
746+
curl -sL "$LATEST_RELEASE_URL" -o vale.tar.gz
747+
tar -xzf vale.tar.gz
748+
sudo mv vale /usr/local/bin/
749+
VALE_INSTALLED=true
750+
fi
751+
fi
752+
fi
753+
fi
754+
755+
# Verify Vale is installed and working
756+
if [ "$VALE_INSTALLED" = "true" ] && command -v vale &> /dev/null; then
757+
echo "Vale installed successfully"
758+
vale --version
759+
else
760+
echo "Vale installation failed. Skipping style checks."
715761
echo "status=skipped" >> $GITHUB_OUTPUT
716762
echo "message=Vale not installed" >> $GITHUB_OUTPUT
717763
echo "::endgroup::"

0 commit comments

Comments
 (0)