From 5534a0ef4b5ed9dcbf6cb0e195dccb0447e604ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADnez?= <28702884+jorgepiloto@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:07:55 +0200 Subject: [PATCH] fix: fail doc-style action when wrong Vale config is present (#470) Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- doc-style/action.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc-style/action.yml b/doc-style/action.yml index effd618f9..677d910f0 100644 --- a/doc-style/action.yml +++ b/doc-style/action.yml @@ -71,6 +71,37 @@ runs: uses: actions/checkout@v4 if: inputs.checkout == 'true' + - uses: ansys/actions/_logging@main + with: + level: "INFO" + message: > + Ensure Vale configuration follows the right layout for the specified + version of Vale. + + - name: "Check Vale's version" + shell: bash + run: | + version=${{ inputs.vale-version }} + vale_major_version=$( echo $version | cut -d '.' -f 1) + echo "VALE_MAJOR_VERSION=$(echo $major)" >> $GITHUB_ENV + + - name: "Verify Vale's configuration layout according to selected version" + shell: bash + run: | + if [ $VALE_MAJOR_VERSION -ge 3 ]; then + if [ ! -d ./doc/styles/config/vocabularies ]; then + echo "Projects using Vale >=v3 require a doc/styles/config/vocabularies directory." + echo "See migration guide https://actions.docs.ansys.com/version/stable/migrations/docs-style-vale-version-update.html" + exit 1 + fi + else + if [ ! -d ./doc/styles/Vocab ] + echo "Projects using Vale <=v2 require a doc/styles/Vocab directory. Consider updating your Vale version to v3." + echo "See migration guide https://actions.docs.ansys.com/version/stable/migrations/docs-style-vale-version-update.html" + exit 1 + fi + fi + - name: "Run Vale" uses: errata-ai/vale-action@reviewdog env: