Skip to content

Commit deaae23

Browse files
authored
Merge branch 'test-vale' into test-vale-pr
2 parents 33bd176 + cf7fe04 commit deaae23

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

.github/workflows/vale.yml

+13-8
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,29 @@ jobs:
2323

2424
- name: Install jq
2525
run: sudo apt-get install -y jq
26-
26+
2727
- name: Get changed files
2828
id: changed-files
2929
run: |
3030
BASE_SHA=$(git merge-base origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }})
3131
CHANGED_FILES=$(git diff --name-only $BASE_SHA ${{ github.sha }} -- '*.md')
3232
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
3333
echo "::set-output name=files::$(echo $CHANGED_FILES | jq -R -s -c 'split("\n")[:-1]')"
34-
34+
3535
- name: Print Changed Files
3636
run: echo $CHANGED_FILES
37-
37+
3838
- name: Run Vale on changed files
3939
run: |
40-
for file in $(echo ${{ steps.changed-files.outputs.files }} | jq -r '.[]'); do
40+
echo "[]" > rdjson_output.jsonl
41+
for file in $(echo "${{ steps.changed-files.outputs.files }}" | jq -r '.[]'); do
4142
echo "Running Vale on $file"
42-
vale --output=JSON $file > "vale_output_${file//\//_}.json"
43-
vale --output=edit $file > "vale_output_${file//\//_}_edit.md"
43+
vale_output=$(vale --output=JSON "$file")
44+
if [ $? -eq 0 ]; then
45+
echo "$vale_output" | jq -c --arg file "$file" '.[] | {file: $file, line: .Line, column: .Span[0], message: .Message, suggestion: (.Suggestions[0] // "")}' >> rdjson_output.jsonl
46+
else
47+
echo "Error processing $file"
48+
fi
4449
done
45-
echo "Vale outputs:"
46-
ls -l
50+
echo "Vale output:"
51+
cat rdjson_output.jsonl

0 commit comments

Comments
 (0)