diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml index 755c8c9bb00..7da98449b2e 100644 --- a/.github/workflows/vale.yml +++ b/.github/workflows/vale.yml @@ -23,7 +23,7 @@ jobs: - name: Install jq run: sudo apt-get install -y jq - + - name: Get changed files id: changed-files run: | @@ -31,16 +31,21 @@ jobs: CHANGED_FILES=$(git diff --name-only $BASE_SHA ${{ github.sha }} -- '*.md') echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV echo "::set-output name=files::$(echo $CHANGED_FILES | jq -R -s -c 'split("\n")[:-1]')" - + - name: Print Changed Files run: echo $CHANGED_FILES - + - name: Run Vale on changed files run: | - for file in $(echo ${{ steps.changed-files.outputs.files }} | jq -r '.[]'); do + echo "[]" > rdjson_output.jsonl + for file in $(echo "${{ steps.changed-files.outputs.files }}" | jq -r '.[]'); do echo "Running Vale on $file" - vale --output=JSON $file > "vale_output_${file//\//_}.json" - vale --output=edit $file > "vale_output_${file//\//_}_edit.md" + vale_output=$(vale --output=JSON "$file") + if [ $? -eq 0 ]; then + echo "$vale_output" | jq -c --arg file "$file" '.[] | {file: $file, line: .Line, column: .Span[0], message: .Message, suggestion: (.Suggestions[0] // "")}' >> rdjson_output.jsonl + else + echo "Error processing $file" + fi done - echo "Vale outputs:" - ls -l + echo "Vale output:" + cat rdjson_output.jsonl