Skip to content

Commit c285c98

Browse files
kurisaWRbb666
authored andcommitted
ci: optimize the logic for generating comments for the maintainer robot
1 parent 1c5568c commit c285c98

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/auto-assign-reviewers.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ jobs:
117117
sort -u triggered_reviewers.txt > unique_reviewers.txt
118118
sort -u triggered_tags.txt > unique_tags.txt
119119
120+
# 检查是否有匹配的 reviewers
121+
if [[ -s unique_reviewers.txt ]]; then
122+
echo "HAS_REVIEWERS=true" >> $GITHUB_OUTPUT
123+
else
124+
echo "HAS_REVIEWERS=false" >> $GITHUB_OUTPUT
125+
fi
126+
120127
echo "=== Matched Paths ==="
121128
cat unique_tags.txt
122129
echo "=== Matched Reviewers ==="
@@ -210,6 +217,7 @@ jobs:
210217
211218
- name: Generate review data
212219
id: generate_review
220+
if: steps.generate_reviewers.outputs.HAS_REVIEWERS == 'true'
213221
run: |
214222
unique_tags=""
215223
if [[ -s unique_tags.txt ]]; then
@@ -280,6 +288,7 @@ jobs:
280288
281289
- name: Post/Update comment
282290
id: post_comment
291+
if: steps.generate_reviewers.outputs.HAS_REVIEWERS == 'true'
283292
run: |
284293
# 查找现有的 bot 评论
285294
existing_comment=$(curl -s \
@@ -306,6 +315,7 @@ jobs:
306315
307316
- name: Get Comment Time
308317
id: get_comment_time
318+
if: steps.generate_reviewers.outputs.HAS_REVIEWERS == 'true'
309319
run: |
310320
existing_comment=$(curl -s \
311321
"https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract-pr.outputs.PR_NUMBER }}/comments" | \
@@ -318,6 +328,7 @@ jobs:
318328
319329
- name: Save Reviewers Cache
320330
id: reviewers-cache-save
331+
if: steps.generate_reviewers.outputs.HAS_REVIEWERS == 'true'
321332
uses: actions/cache/save@v4
322333
with:
323334
path: |

0 commit comments

Comments
 (0)