Skip to content

Commit 965d63c

Browse files
authored
Update check-format.yml
1 parent 8f008bd commit 965d63c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/check-format.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,30 @@ jobs:
8989
with:
9090
github-token: ${{ secrets.GITHUB_TOKEN }}
9191
review-message: ${{ steps.comment.outputs.body }}
92+
93+
- name: Dismiss previous change requests
94+
if: success()
95+
uses: actions/github-script@v7
96+
with:
97+
github-token: ${{ secrets.GITHUB_TOKEN }}
98+
script: |
99+
const { data: reviews } = await github.rest.pulls.listReviews({
100+
owner: context.repo.owner,
101+
repo: context.repo.repo,
102+
pull_number: context.payload.pull_request.number
103+
});
104+
for (const review of reviews) {
105+
if (
106+
review.state === 'CHANGES_REQUESTED' &&
107+
review.user.login === 'github-actions[bot]'
108+
) {
109+
await github.rest.pulls.dismissReview({
110+
owner: context.repo.owner,
111+
repo: context.repo.repo,
112+
pull_number: context.payload.pull_request.number,
113+
review_id: review.id,
114+
message: '格式检查已通过,此更改请求已解决。'
115+
});
116+
}
117+
}
118+

0 commit comments

Comments
 (0)