Skip to content

Commit 1b2abd5

Browse files
committed
ci: Improve reviewdog
1 parent 335947c commit 1b2abd5

File tree

2 files changed

+14
-29
lines changed

2 files changed

+14
-29
lines changed

.github/workflows/commit/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,9 @@ runs:
9292
with:
9393
name: reviewdog-suggestions
9494
path: reviewdog-diff.txt
95+
96+
- name: Cleanup diff file
97+
if: steps.commit.outputs.use_reviewdog == 'true'
98+
run: |
99+
rm reviewdog-diff.txt
100+
shell: bash

.github/workflows/reviewdog-suggester.yaml

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,35 +43,14 @@ jobs:
4343
with:
4444
ref: ${{ github.event.workflow_run.head_sha }}
4545

46-
- name: Apply diff and suggest via reviewdog
46+
- name: Apply diff
4747
if: steps.check-artifact.outputs.has_diff == 'true'
48-
env:
49-
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5048
run: |
51-
# Install reviewdog
52-
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b /usr/local/bin
53-
54-
# Get PR number from the workflow run
55-
PR_NUMBER=$(gh api \
56-
-H "Accept: application/vnd.github+json" \
57-
-H "X-GitHub-Api-Version: 2022-11-28" \
58-
/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }} \
59-
--jq '.pull_requests[0].number')
60-
61-
echo "PR Number: ${PR_NUMBER}"
62-
63-
if [ -z "${PR_NUMBER}" ] || [ "${PR_NUMBER}" = "null" ]; then
64-
echo "No PR associated with this workflow run"
65-
exit 0
66-
fi
67-
68-
# Convert diff to reviewdog format and post suggestions
69-
cat reviewdog-diff.txt | reviewdog \
70-
-f=diff \
71-
-name="rcc" \
72-
-reporter=github-pr-review \
73-
-filter-mode=nofilter \
74-
-fail-on-error=false
49+
patch -p1 < reviewdog-diff.txt
7550
shell: bash
76-
env:
77-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Post suggestions via reviewdog
53+
if: steps.check-artifact.outputs.has_diff == 'true'
54+
uses: krlmlr/action-suggester@main
55+
with:
56+
tool_name: rcc

0 commit comments

Comments
 (0)