diff --git a/.github/workflows/auto-assign-reviewers.yml b/.github/workflows/auto-assign-reviewers.yml index 8fc10453cca..2b06227fb99 100644 --- a/.github/workflows/auto-assign-reviewers.yml +++ b/.github/workflows/auto-assign-reviewers.yml @@ -23,7 +23,7 @@ on: jobs: assign-reviewers: runs-on: ubuntu-22.04 - if: github.repository_owner == 'RT-Thread' + # if: github.repository_owner == 'RT-Thread' permissions: issues: read pull-requests: write @@ -87,7 +87,7 @@ jobs: # Check if response is valid JSON if jq -e . >/dev/null 2>&1 <<<"$existing_comment"; then - existing_comment=$(jq -r '.[] | select(.user.login == "github-actions[bot]") | {body: .body} | @base64' <<< "$existing_comment") + existing_comment=$(jq -r '.[] | select(.user.login == "github-actions[bot]" and (.body | contains(""))) | {body: .body} | @base64' <<< "$existing_comment") else existing_comment="" echo "Warning: Invalid JSON response from GitHub API for comments" @@ -341,6 +341,7 @@ jobs: fi current_time=$(TZ='Asia/Shanghai' date +"%Y-%m-%d %H:%M CST") { + echo "" echo "## 📌 Code Review Assignment" echo "" for tag in $unique_tags; do @@ -399,7 +400,7 @@ jobs: existing_comment=$(curl -s \ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract-pr.outputs.PR_NUMBER }}/comments" | \ - jq -r '.[] | select(.user.login == "github-actions[bot]") | {id: .id, body: .body} | @base64') + jq -r '.[] | select(.user.login == "github-actions[bot]" and (.body | contains(""))) | {id: .id, body: .body} | @base64') if [[ -n "$existing_comment" ]]; then # 更新现有评论 @@ -428,7 +429,7 @@ jobs: # Check if response is valid JSON if jq -e . >/dev/null 2>&1 <<<"$existing_comment"; then - existing_comment=$(jq -r '.[] | select(.user.login == "github-actions[bot]") | {body: .body} | @base64' <<< "$existing_comment") + existing_comment=$(jq -r '.[] | select(.user.login == "github-actions[bot]" and (.body | contains(""))) | {body: .body} | @base64' <<< "$existing_comment") else existing_comment="" echo "Warning: Invalid JSON response from GitHub API" @@ -461,4 +462,4 @@ jobs: path: | unique_tags_bak.txt unique_reviewers_bak.txt - key: ${{ runner.os }}-auto-assign-reviewers-${{ steps.extract-pr.outputs.PR_NUMBER }}-${{ steps.get_comment_time.outputs.CACHE_TIMESTAMP }}-${{ github.run_id }} \ No newline at end of file + key: ${{ runner.os }}-auto-assign-reviewers-${{ steps.extract-pr.outputs.PR_NUMBER }}-${{ steps.get_comment_time.outputs.CACHE_TIMESTAMP }}-${{ github.run_id }} diff --git a/.github/workflows/pr_format_bot.yml b/.github/workflows/pr_format_bot.yml index b36cace603e..891b61b2812 100644 --- a/.github/workflows/pr_format_bot.yml +++ b/.github/workflows/pr_format_bot.yml @@ -9,7 +9,7 @@ permissions: jobs: notify-format: - if: github.repository_owner == 'RT-Thread' + # if: github.repository_owner == 'RT-Thread' runs-on: ubuntu-latest steps: - name: Check if first commit and add comment @@ -47,6 +47,7 @@ jobs: # 使用数组存储多行消息 message_lines=( + "" "**👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!**" "" "为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流。" @@ -82,26 +83,46 @@ jobs: echo "Message content:" echo "$message" + # 查找现有的 bot 评论 + existing_comment=$(curl -s \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" | \ + jq -r '.[] | select(.user.login == "github-actions[bot]" and (.body | contains(""))) | {id: .id, body: .body} | @base64') + # 使用 jq 安全地构建 JSON 负载 json_payload=$(jq -n --arg body "$message" '{"body": $body}') - # 发送评论到 PR - response=$(curl -s -w "\n%{http_code}" \ - -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: Bearer $GITHUB_TOKEN" \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \ - -d "$json_payload") + if [[ -n "$existing_comment" ]]; then + # 更新现有评论 + comment_id=$(echo "$existing_comment" | head -1 | base64 -d | jq -r .id) + echo "Updating existing comment $comment_id" + response=$(curl -s -w "\n%{http_code}" \ + -X PATCH \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -d "$json_payload" \ + "https://api.github.com/repos/${{ github.repository }}/issues/comments/$comment_id") + else + # 创建新评论 + echo "Creating new comment" + response=$(curl -s -w "\n%{http_code}" \ + -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -d "$json_payload" \ + "https://api.github.com/repos/${{ github.event.pull_request.number }}/comments") + fi # 提取 HTTP 状态码和响应体 http_code=$(echo "$response" | tail -n1) response_body=$(echo "$response" | sed '$d') - if [ "$http_code" -eq 201 ]; then - echo "Format notification comment added successfully" + if [ "$http_code" -eq 201 ] || [ "$http_code" -eq 200 ]; then + echo "Format notification comment added/updated successfully" echo "Comment URL: $(echo "$response_body" | jq -r '.html_url')" else - echo "Failed to add comment. HTTP status: $http_code" + echo "Failed to add/update comment. HTTP status: $http_code" echo "Response: $response_body" exit 1 fi diff --git a/bsp/renesas/ra4e2-ek/.api_xml b/bsp/renesas/ra4e2-ek/.api_xml index fc9bf0b30e4..779475a3962 100644 --- a/bsp/renesas/ra4e2-ek/.api_xml +++ b/bsp/renesas/ra4e2-ek/.api_xml @@ -1,2 +1,3 @@ +