@@ -35,26 +35,13 @@ jobs:
3535
3636 - name : Get changed files
3737 id : changed_files
38- # uses: tj-actions/changed-files@v45
39-
4038 run : |
4139 # 通过 GitHub API 获取 PR 的变更文件列表
4240 changed_files=$(curl -s \
4341 -H "Authorization: Bearer ${{ github.token }}" \
4442 "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
4543 jq -r '.[].filename') # 使用 jq 提取文件名
46- curl -s \
47- -H "Authorization: Bearer ${{ github.token }}" \
48- "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
4944 echo "$changed_files" | grep -v '^MAINTAINERS$' > changed_files.txt
50- # - name: List all changed files
51- # env:
52- # ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
53- # run: |
54- # for file in ${ALL_CHANGED_FILES}; do
55- # echo "$file was changed"
56- # done
57- # echo "${ALL_CHANGED_FILES}" | grep -v '^MAINTAINERS$' > changed_files.txt
5845 - name : Parse MAINTAINERS file
5946 id : parse_maintainer
6047 run : |
@@ -175,15 +162,12 @@ jobs:
175162 echo "> ℹ️ **刷新CI状态操作需要具备仓库写入权限。**"
176163 echo "> ℹ️ **Refresh CI status operation requires repository Write permission.**"
177164 } > review_data.md
178- pwd
179- whereis review_data.md
180- cat /home/runner/work/rt-thread/rt-thread/review_data.md
181165 - name : Post/Update comment
182166 id : post_comment
183167 run : |
184168 # 查找现有的 bot 评论
185169 existing_comment=$(curl -s \
186- -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }} " \
170+ -H "Authorization: Bearer $SUPER_SECRET " \
187171 "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | \
188172 jq -r '.[] | select(.user.login == "github-actions[bot]") | {id: .id, body: .body} | @base64')
189173
@@ -192,38 +176,14 @@ jobs:
192176 comment_id=$(echo "$existing_comment" | head -1 | base64 -d | jq -r .id)
193177 echo "Updating existing comment $comment_id"
194178 response=$(curl -s -X PATCH \
195- -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }} " \
179+ -H "Authorization: Bearer $SUPER_SECRET " \
196180 -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
197181 "https://api.github.com/repos/${{ github.repository }}/issues/comments/$comment_id")
198182 else
199183 # 创建新评论
200184 echo "Creating new comment"
201- response=$(curl -s -X POST \
202- -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
203- -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
204- "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
205- echo ${{ secrets.GITHUB_TOKEN }}
206- fi
207- echo "Creating new comment"
208- response=$(curl -s -X POST \
209- -H "Authorization: Bearer ${{ github.token }}" \
210- -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
211- "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
212- echo github.token
213- echo "Creating new comment"
214185 response=$(curl -s -X POST \
215186 -H "Authorization: Bearer $SUPER_SECRET" \
216187 -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
217188 "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
218- echo $SUPER_SECRET
219- echo "Creating new comment"
220- response=$(curl -s -X POST \
221- -H "Authorization: Bearer ${{ vars.TOKEN }}" \
222- -d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
223- "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments")
224- - name : Pos1t comment
225- uses : harupy/comment-on-pr@master
226- env :
227- GITHUB_TOKEN : ${{ secrets.ACTION_TOKEN_AUTO_REVIEW1 }}
228- with :
229- filename : /home/runner/work/rt-thread/rt-thread/review_data.md
189+ fi
0 commit comments