3030 steps :
3131 - name : Checkout code
3232 uses : actions/checkout@v3
33- with :
34- github_token : ${{ secrets.ACTION_TOKEN_AUTO_REVIEW2 }}
33+
3534 - name : Get changed files
3635 id : changed_files
3736 # uses: tj-actions/changed-files@v45
@@ -177,10 +176,12 @@ jobs:
177176
178177 - name : Post/Update comment
179178 id : post_comment
179+ env :
180+ github_token : ${{ secrets.ACTION_TOKEN_AUTO_REVIEW2 }}
180181 run : |
181182 # 查找现有的 bot 评论
182183 existing_comment=$(curl -s \
183- -H "Authorization: Bearer ${{ secrets.ACTION_TOKEN_AUTO_REVIEW1 }}" \
184+ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
184185 "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | \
185186 jq -r '.[] | select(.user.login == "github-actions[bot]") | {id: .id, body: .body} | @base64')
186187
@@ -189,25 +190,25 @@ jobs:
189190 comment_id=$(echo "$existing_comment" | head -1 | base64 -d | jq -r .id)
190191 echo "Updating existing comment $comment_id"
191192 response=$(curl -s -X PATCH \
192- -H "Authorization: Bearer ${{ secrets.ACTION_TOKEN_AUTO_REVIEW1 }}" \
193+ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
193194 -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
194195 "https://api.github.com/repos/${{ github.repository }}/issues/comments/$comment_id")
195196 else
196197 # 创建新评论
197198 echo "Creating new comment"
198199 response=$(curl -s -X POST \
199- -H "Authorization: Bearer ${{ secrets.ACTION_TOKEN_AUTO_REVIEW1 }}" \
200+ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
200201 -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
201202 "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
202203 fi
203204 # 创建新评论
204- echo "Creating new comment"
205- response=$(curl -s -X POST \
206- -H "Authorization: Bearer ${{ github.token }}" \
207- -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
208- "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
209- echo "Creating new comment"
210- response=$(curl -s -X POST \
211- -H "Authorization: Bearer ${{ github_token }}" \
212- -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
213- "https://api.github.com/repos/${{ github.repository }}/issues/ ${{ github.event.pull_request.number }}/comments")
205+ echo "Creating new comment"
206+ response=$(curl -s -X POST \
207+ -H "Authorization: Bearer ${{ github_token }}" \
208+ -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
209+ "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
210+ - name : Comment on PR
211+ uses : unsplash/comment-on-pr@master
212+ with :
213+ message : " 欢迎提交PR!我们的团队将会尽快审查。 "
214+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments