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 14, 2024
2 parents 68e2e62 + 1fd5393 commit 385c3a9
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,24 @@ jobs:
- name: Run Vale on changed files
run: |
echo "[]" > rdjson_output.jsonl
for file in $(echo "${{ steps.changed-files.outputs.files }}" | jq -r '.[]'); do
for file in $(echo ${{ steps.changed-files.outputs.files }} | jq -r '.[]'); do
echo "Running Vale on $file"
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
vale --output=JSON $file | jq -c '.[] | {file: "'$file'", line: .Line, column: .Span[0], message: .Message, suggestion: (.Suggestions[0] // "")}' >> rdjson_output.jsonl || echo "Error processing $file"
done
echo "Vale output:"
cat rdjson_output.jsonl
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}

- name: Check if rdjson_output.jsonl exists
run: |
if [ -f rdjson_output.jsonl ]; then
echo "rdjson_output.jsonl exists."
else
echo "rdjson_output.jsonl does not exist."
exit 1
fi
- name: Upload Vale results
uses: actions/upload-artifact@v3
with:
Expand All @@ -69,6 +72,18 @@ jobs:
with:
name: vale-results

- name: List downloaded files
run: ls -l

- name: Check if rdjson_output.jsonl exists
run: |
if [ -f rdjson_output.jsonl ]; then
echo "rdjson_output.jsonl exists."
else
echo "rdjson_output.jsonl does not exist."
exit 1
fi
- name: Run Reviewdog Suggestion Action
uses: reviewdog/action-suggester@v1
with:
Expand All @@ -82,6 +97,7 @@ jobs:

- name: Run Reviewdog with Vale results
run: |
cat rdjson_output.jsonl
reviewdog -f=rdjsonl -name="Vale" -reporter=github-pr-review -level=warning -filter-mode=nofilter < rdjson_output.jsonl
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}

0 comments on commit 385c3a9

Please sign in to comment.