Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 committed Jun 17, 2024
1 parent 628159f commit e8d5d49
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:

permissions:
contents: read
pull-requests: write
pull-requests: write

jobs:
vale: # Vale linting job
vale: # Vale linting and suggesting job
runs-on: ubuntu-latest

steps:
Expand All @@ -30,27 +30,28 @@ jobs:
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 "CHANGED_FILES=$(echo $CHANGED_FILES | jq -R -s -c 'split(\"\n\")[:-1]')" >> $GITHUB_ENV
echo "CHANGED_FILES=$(echo \"$CHANGED_FILES\" | jq -R -s -c 'split(\"\n\")[:-1]')" >> $GITHUB_ENV
- name: Print Changed Files
run: echo $CHANGED_FILES
run: echo "CHANGED_FILES is: ${{ env.CHANGED_FILES }}"

- name: Run Vale on changed files
run: |
for file in ${{ env.CHANGED_FILES }}; do
for file in $(echo $CHANGED_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"
done
echo "Vale outputs:"
ls -l
echo "Vale output files:"
ls -l vale_output_*
- name: Apply Vale edits and save originals
run: |
mkdir -p original_files
mkdir -p corrected_files
for file in ${{ env.CHANGED_FILES }}; do
for file in $(echo $CHANGED_FILES | jq -r '.[]'); do
echo "Copying $file to original_files/${file//\//_}.original"
cp "$file" "original_files/${file//\//_}.original"
echo "Copying vale_output_${file//\//_}_edit.md to corrected_files/${file//\//_}"
Expand All @@ -63,9 +64,6 @@ jobs:
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }}

- name: Debug Check Changed Files Environment Variable
run: echo "CHANGED_FILES is: ${{ env.CHANGED_FILES }}"

- name: Run Reviewdog Suggestion Action
uses: reviewdog/action-suggester@v1
with:
Expand Down

0 comments on commit e8d5d49

Please sign in to comment.