Skip to content

Commit 699d70d

Browse files
authored
Merge pull request #523 from netwrix/dev
resolve Vale inline comment threads after fixes are applied
2 parents f810390 + a10ad82 commit 699d70d

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

.github/workflows/claude-doc-pr.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ jobs:
276276
/doc-pr-fix ${{ steps.pr-info.outputs.number }} $COMMENT_BODY
277277
claude_args: '--allowedTools "Bash(gh:*),Bash(git:*),Read,Write,Edit,Glob,Grep,Skill(doc-pr-fix),Skill(dale),Skill(doc-help)"'
278278

279-
- name: Resolve Dale inline comments
279+
- name: Resolve inline comments and dismiss old reviews
280280
if: steps.pr-info.outputs.is_fork == 'false' && steps.pr-info.outputs.targets_dev == 'true'
281281
env:
282282
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -286,7 +286,7 @@ jobs:
286286
OWNER="${REPO%%/*}"
287287
NAME="${REPO##*/}"
288288
289-
# Resolve all Dale inline comment threads
289+
# Resolve all Dale and Vale inline comment threads
290290
THREAD_IDS=$(gh api graphql -f query='
291291
query($owner:String!,$name:String!,$pr:Int!) {
292292
repository(owner:$owner,name:$name) {
@@ -297,17 +297,17 @@ jobs:
297297
}
298298
}
299299
}' -f owner="$OWNER" -f name="$NAME" -F pr="$PR_NUMBER" \
300-
--jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and (.comments.nodes[0].body | contains("**Dale**"))) | .id' 2>/dev/null || true)
300+
--jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and ((.comments.nodes[0].body | contains("**Dale**")) or (.comments.nodes[0].body | contains("**Vale**")))) | .id' 2>/dev/null || true)
301301
for TID in $THREAD_IDS; do
302302
gh api graphql -f query='
303303
mutation($tid:ID!) {
304304
resolveReviewThread(input:{threadId:$tid}) { thread { isResolved } }
305305
}' -f tid="$TID" 2>/dev/null || true
306306
done
307307
308-
# Dismiss all previous Dale reviews
308+
# Dismiss all previous Dale and Vale reviews
309309
REVIEW_IDS=$(gh api repos/${REPO}/pulls/${PR_NUMBER}/reviews \
310-
--jq '[.[] | select(.user.login == "github-actions[bot]" and (.body | contains("Dale found"))) | .id] | .[]' 2>/dev/null || true)
310+
--jq '[.[] | select(.user.login == "github-actions[bot]" and ((.body | contains("Dale found")) or (.body | contains("Vale found")))) | .id] | .[]' 2>/dev/null || true)
311311
for ID in $REVIEW_IDS; do
312312
gh api repos/${REPO}/pulls/${PR_NUMBER}/reviews/${ID}/dismissals \
313313
-f message="Superseded after fixes applied" -f event="DISMISS" 2>/dev/null || true

.github/workflows/vale-linter.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,27 @@ jobs:
163163
PR_NUMBER=${{ github.event.pull_request.number }}
164164
REPO=${{ github.repository }}
165165
166+
# Resolve previous Vale inline comment threads
167+
OWNER="${REPO%%/*}"
168+
NAME="${REPO##*/}"
169+
THREAD_IDS=$(gh api graphql -f query='
170+
query($owner:String!,$name:String!,$pr:Int!) {
171+
repository(owner:$owner,name:$name) {
172+
pullRequest(number:$pr) {
173+
reviewThreads(first:100) {
174+
nodes { id isResolved comments(first:1) { nodes { body } } }
175+
}
176+
}
177+
}
178+
}' -f owner="$OWNER" -f name="$NAME" -F pr="$PR_NUMBER" \
179+
--jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false and (.comments.nodes[0].body | contains("**Vale**"))) | .id' 2>/dev/null || true)
180+
for TID in $THREAD_IDS; do
181+
gh api graphql -f query='
182+
mutation($tid:ID!) {
183+
resolveReviewThread(input:{threadId:$tid}) { thread { isResolved } }
184+
}' -f tid="$TID" 2>/dev/null || true
185+
done
186+
166187
# Delete previous Vale PR comments
167188
COMMENT_IDS=$(gh api "repos/${REPO}/issues/${PR_NUMBER}/comments" --jq '[.[] | select(.user.login == "github-actions[bot]" and (.body | contains("## Vale Linting"))) | .id] | .[]' 2>/dev/null || true)
168189
for ID in $COMMENT_IDS; do

0 commit comments

Comments
 (0)