Skip to content

Commit 9bb4290

Browse files
authored
Merge pull request RT-Thread#1 from hydevcode/patch-1
Update auto-assign-reviewers.yml
2 parents 1a32ff0 + 5335efa commit 9bb4290

File tree

1 file changed

+12
-29
lines changed

1 file changed

+12
-29
lines changed

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

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
name: Auto Review Assistant
1414

1515
on:
16-
pull_request_target:
16+
pull_request:
1717
types: [opened, synchronize, reopened]
1818
workflow_dispatch:
1919
issue_comment:
@@ -25,12 +25,13 @@ jobs:
2525
if: github.repository_owner == 'RT-Thread'
2626
permissions:
2727
issues: write
28-
pull-requests: write
28+
pull-requests: read
2929
contents: read
3030
steps:
3131
- name: Checkout code
3232
uses: actions/checkout@v3
33-
33+
with:
34+
persist-credentials: false
3435
- name: Get changed files
3536
id: changed_files
3637
run: |
@@ -143,8 +144,6 @@ jobs:
143144
fi
144145
done < tag_data.csv
145146
# 插入审查状态
146-
cat review_status.md
147-
148147
echo "---"
149148
echo "### 📝 Review Instructions"
150149
echo ""
@@ -160,28 +159,12 @@ jobs:
160159
echo "> ℹ️ **刷新CI状态操作需要具备仓库写入权限。**"
161160
echo "> ℹ️ **Refresh CI status operation requires repository Write permission.**"
162161
} > review_data.md
163-
- name: Post/Update comment
164-
id: post_comment
162+
- name: Save PR number
165163
run: |
166-
# 查找现有的 bot 评论
167-
existing_comment=$(curl -s \
168-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
169-
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | \
170-
jq -r '.[] | select(.user.login == "github-actions[bot]") | {id: .id, body: .body} | @base64')
171-
172-
if [[ -n "$existing_comment" ]]; then
173-
# 更新现有评论
174-
comment_id=$(echo "$existing_comment" | head -1 | base64 -d | jq -r .id)
175-
echo "Updating existing comment $comment_id"
176-
response=$(curl -s -X PATCH \
177-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
178-
-d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
179-
"https://api.github.com/repos/${{ github.repository }}/issues/comments/$comment_id")
180-
else
181-
# 创建新评论
182-
echo "Creating new comment"
183-
response=$(curl -s -X POST \
184-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
185-
-d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
186-
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
187-
fi
164+
mkdir -p ./pr
165+
echo ${{ github.event.number }} > ./pr/NR
166+
mv /home/runner/work/rt-thread/rt-thread/review_data.md ./pr/
167+
- uses: actions/upload-artifact@v4
168+
with:
169+
name: pr
170+
path: pr

0 commit comments

Comments
 (0)