Skip to content

Commit

Permalink
Merge branch 'test-vale' into test-vale-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Jun 17, 2024
2 parents 33bd176 + cf7fe04 commit deaae23
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,29 @@ jobs:

- name: Install jq
run: sudo apt-get install -y jq

- name: Get changed files
id: changed-files
run: |
BASE_SHA=$(git merge-base origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }})
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

0 comments on commit deaae23

Please sign in to comment.