diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml new file mode 100644 index 00000000000..8557d3b53e6 --- /dev/null +++ b/.github/workflows/reviewdog.yml @@ -0,0 +1,25 @@ +name: Reviewdog suggester + +on: + pull_request: + paths: + - '**/*.md' + +jobs: + suggest: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run Reviewdog Suggestion Action + uses: reviewdog/action-suggester@v1 + with: + github_token: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }} + tool_name: Vale + level: "warning" + filter_mode: "diff_context" + fail_on_error: "false" + reviewdog_flags: "" + cleanup: "true" diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml index 5dd79c18c67..26c6ffdc07c 100644 --- a/.github/workflows/vale.yml +++ b/.github/workflows/vale.yml @@ -12,8 +12,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - with: - fetch-depth: 0 + + - name: Install Vale + uses: errata-ai/vale-action@v2 - name: Install jq run: sudo apt-get install -y jq @@ -29,46 +30,15 @@ jobs: - name: Print Changed Files run: echo $CHANGED_FILES - - name: Install Vale - uses: errata-ai/vale-action@v2 - - - name: Install Reviewdog - uses: reviewdog/action-setup@v1 - with: - reviewdog_version: latest - - name: Run Vale on changed files run: | for file in $(echo ${{ steps.changed-files.outputs.files }} | jq -r '.[]'); do echo "Running Vale on $file" vale --output=JSON $file > vale_output.json cat vale_output.json - done - - - name: Process Vale output - run: | - for file in $(echo ${{ steps.changed-files.outputs.files }} | jq -r '.[]'); do - vale --output=JSON $file > vale_output.json - cat vale_output.json cat vale_output.json | jq -c '.[] | {file: "'$file'", line: .Line, column: .Span[0], message: .Message, suggestion: .Suggestions[0]}' > rdjson_output.jsonl cat rdjson_output.jsonl - done - - - name: Run Reviewdog with processed output - run: | - for file in $(echo ${{ steps.changed-files.outputs.files }} | jq -r '.[]'); do cat rdjson_output.jsonl | reviewdog -f=rdjsonl -name="Vale" -reporter=github-pr-review -level=warning -filter-mode=nofilter done env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }} - - - name: Run Reviewdog Suggestion Action - uses: reviewdog/action-suggester@v1 - with: - github_token: ${{ secrets.REVIEWDOG_GITHUB_API_TOKEN }} - tool_name: Vale - level: "warning" - filter_mode: "diff_context" - fail_on_error: "false" - reviewdog_flags: "" - cleanup: "true"