From e8af3fcb0bf22d8b528feb5cb977b27686bccf3e Mon Sep 17 00:00:00 2001 From: mirnawong1 Date: Fri, 14 Jun 2024 16:08:29 +0100 Subject: [PATCH] add --- .github/workflows/vale.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml index 7d9524e7b76..0eef0d3a64f 100644 --- a/.github/workflows/vale.yml +++ b/.github/workflows/vale.yml @@ -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 @@ -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: @@ -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