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 135e74e + e8af3fc commit 9801dfb
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,28 @@ jobs:
echo "Vale outputs:"
ls -l
- name: Apply Vale edits
- name: Apply Vale edits and save originals
run: |
mkdir -p original_files
mkdir -p corrected_files
for file in $(echo ${{ steps.changed-files.outputs.files }} | jq -r '.[]'); do
mv $file "${file}.original"
mv "vale_output_${file//\//_}_edit.md" $file
cp $file "original_files/${file//\//_}.original"
cp "vale_output_${file//\//_}_edit.md" "corrected_files/${file//\//_}"
done
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}

- name: Upload original files
uses: actions/upload-artifact@v3
with:
name: original-files
path: original_files/

- name: Upload corrected files
uses: actions/upload-artifact@v3
with:
name: corrected-files
path: '*.md'
path: corrected_files/

suggest: # Reviewdog suggestion job
runs-on: ubuntu-latest
Expand All @@ -65,6 +73,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Download original files
uses: actions/download-artifact@v3
with:
name: original-files

- name: Download corrected files
uses: actions/download-artifact@v3
with:
Expand All @@ -86,9 +99,9 @@ jobs:

- name: Run Reviewdog with corrected files
run: |
for file in $(ls *.md.original); do
original="${file}"
corrected="${file%.original}"
for file in original_files/*.original; do
original="$file"
corrected="corrected_files/$(basename "$file" .original)"
diff_output=$(diff -u "$original" "$corrected")
if [[ -n "$diff_output" ]]; then
echo "$diff_output" | reviewdog -f=diff -name="Vale" -reporter=github-pr-review -level=warning -filter-mode=nofilter
Expand Down

0 comments on commit 9801dfb

Please sign in to comment.