Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7f0131c
Add VDSO functionality under the riscv64 architecture.
ScuDays Apr 22, 2025
52c7674
修复components/lwp/vdso/SConscript依赖CPP和CPPFLAGS的问题
ScuDays Apr 28, 2025
a451d47
修复当没有设置环境变量时scons -c出现的问题
ScuDays May 6, 2025
f0e716d
修复vdso中构建时候找不到gcc路径的问题
ScuDays May 7, 2025
ca901cd
修复CI问题
ScuDays May 8, 2025
6e6e481
修复CI问题
ScuDays May 8, 2025
badcd88
Merge branch 'RT-Thread:master' into master
ScuDays May 8, 2025
22d801d
尝试修复CI问题
ScuDays May 8, 2025
98b3c68
尝试修复k230找不到工具链的问题
ScuDays May 8, 2025
8494a41
[smart] code cleanup for vdso.
BernardXiong May 10, 2025
4f0726e
[smart] fix the vdso building issue in linux
BernardXiong May 10, 2025
5b46cce
[smart][vdso] Add prefix:`RTT_` in ENV variables for vdso building.
BernardXiong May 11, 2025
4909188
ci: fixed the abnormal operation of ci files (#10259)
kurisaW May 12, 2025
1c5568c
Fixed missing unique files creation and cache logic
kurisaW May 12, 2025
c285c98
ci: optimize the logic for generating comments for the maintainer robot
kurisaW May 12, 2025
0a57f0a
bsp:stm32:add Dependency packages missing, please running 'pkgs --upd…
fengmuyou May 7, 2025
40f42f3
bsp/stm32: Separate stm32mp1 hal drivers (#10264)
fengmuyou May 12, 2025
27430ca
bsp/nxp:Separate NXP_MCX drivers (#10246)
hydevcode May 12, 2025
61c628d
Add VDSO functionality under the riscv64 architecture.
ScuDays Apr 22, 2025
948f9c9
修复components/lwp/vdso/SConscript依赖CPP和CPPFLAGS的问题
ScuDays Apr 28, 2025
f56512a
修复当没有设置环境变量时scons -c出现的问题
ScuDays May 6, 2025
ee71fa9
修复vdso中构建时候找不到gcc路径的问题
ScuDays May 7, 2025
7ae1dcc
修复CI问题
ScuDays May 8, 2025
e7c336e
修复CI问题
ScuDays May 8, 2025
dfb82da
尝试修复CI问题
ScuDays May 8, 2025
c5c3c96
尝试修复k230找不到工具链的问题
ScuDays May 8, 2025
ca65e50
[smart] code cleanup for vdso.
BernardXiong May 10, 2025
807e5d8
[smart] fix the vdso building issue in linux
BernardXiong May 10, 2025
ac514ec
[smart][vdso] Add prefix:`RTT_` in ENV variables for vdso building.
BernardXiong May 11, 2025
9c5d21d
Merge branch 'risc_vdso' of https://github.com/BernardXiong/rt-thread…
BernardXiong May 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
91 changes: 68 additions & 23 deletions .github/workflows/auto-assign-reviewers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Date Author Notes
# 2025-01-21 kurisaW Initial version
# 2025-03-14 hydevcode
# 2025-05-10 kurisaW Fixed file existence, cache, and comment time issues
# 2025-05-11 kurisaW Fixed missing unique files creation and cache logic

# Script Function Description: Assign PR reviews based on the MAINTAINERS list.

Expand All @@ -31,12 +33,14 @@ jobs:
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_OUTPUT

- name: Checkout code
uses: actions/checkout@v4
with:
ref: master
sparse-checkout: MAINTAINERS
persist-credentials: false

- name: Get changed files
id: changed_files
run: |
Expand All @@ -47,22 +51,25 @@ jobs:
echo "$changed_files" | grep -v '^MAINTAINERS$' > changed_files.txt

existing_comment=$(curl -s \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract-pr.outputs.PR_NUMBER }}/comments" | \
jq -r '.[] | select(.user.login == "github-actions[bot]") | {body: .body} | @base64')
"https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract-pr.outputs.PR_NUMBER }}/comments" | \
jq -r '.[] | select(.user.login == "github-actions[bot]") | {body: .body} | @base64')

echo "=== Changed Files ==="
cat changed_files.txt
echo "====================="

comment_body=""
if [[ ! -z "$existing_comment" ]]; then
comment_body=$(echo "$existing_comment" | head -1 | base64 -d | jq -r .body|sed -nE 's/.*Last Updated: ([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2} UTC).*/\1/p')

comment_body=$(echo "$existing_comment" | head -1 | base64 -d | jq -r .body | sed -nE 's/.*Last Updated: ([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2} UTC).*/\1/p')
comment_time=$(date -d "$comment_body" +%s)

echo "${comment_body}"
echo "COMMENT_TIME=${comment_time}" >> $GITHUB_OUTPUT
else
comment_time=""
echo "COMMENT_TIME=${comment_time}" >> $GITHUB_OUTPUT
fi
echo "COMMENT_TIME=${comment_time}"

- name: Parse MAINTAINERS file
id: parse_maintainer
run: |
Expand All @@ -72,8 +79,10 @@ jobs:
/^tag:/ {
tag = substr($0, index($0, $2)) # 提取标签内容
}
/^path:/ {
path = substr($0, index($0, $2)) # 提取路径内容
/^path:/ {
# 提取 path 字段并去除前后空格
path = substr($0, index($0, $2))
gsub(/^[ \t]+|[ \t]+$/, "", path) # 清理前后空格和制表符
}
/^owners:/ {
owners = substr($0, index($0, $2)) # 提取维护者信息
Expand All @@ -85,21 +94,41 @@ jobs:
print tag "|" path "|" github_ids
}
' MAINTAINERS > tag_data.csv

- name: Generate reviewers list
id: generate_reviewers
run: |
# 根据变更文件路径匹配维护者规则
rm -f triggered_reviewers.txt
rm -f triggered_tags.txt
rm -f triggered_reviewers.txt triggered_tags.txt unique_reviewers.txt unique_tags.txt
touch triggered_reviewers.txt triggered_tags.txt unique_reviewers.txt unique_tags.txt

while IFS='|' read -r tag path reviewers; do
# 使用正则匹配路径(支持子目录)
if grep -qE "^$path(/|$)" changed_files.txt; then
echo "$reviewers" | tr ' ' '\n' >> triggered_reviewers.txt
echo "$tag" | tr ' ' '\n' >> triggered_tags.txt
# 转义路径中的正则特殊字符
escaped_path=$(sed 's/[.[\*^$]/\\&/g' <<< "$path")

# 使用增强型正则匹配路径及其所有子目录
if grep -qE "^$escaped_path(/.*)*" changed_files.txt; then
echo "$reviewers" | tr -s ' ' '\n' | sed '/^$/d' >> triggered_reviewers.txt
echo "$tag" >> triggered_tags.txt
echo "Matched: $path → $tag"
fi
done < tag_data.csv
awk 'NF && !seen[$0]++' triggered_reviewers.txt > unique_reviewers.txt
awk 'NF && !seen[$0]++' triggered_tags.txt > unique_tags.txt

# 生成去重的 unique_reviewers.txt 和 unique_tags.txt
sort -u triggered_reviewers.txt > unique_reviewers.txt
sort -u triggered_tags.txt > unique_tags.txt

# 检查是否有匹配的 reviewers
if [[ -s unique_reviewers.txt ]]; then
echo "HAS_REVIEWERS=true" >> $GITHUB_OUTPUT
else
echo "HAS_REVIEWERS=false" >> $GITHUB_OUTPUT
fi

echo "=== Matched Paths ==="
cat unique_tags.txt
echo "=== Matched Reviewers ==="
cat unique_reviewers.txt

- name: Restore Reviewers Cache
id: reviewers-cache-restore
if: ${{ steps.changed_files.outputs.COMMENT_TIME != '' }}
Expand All @@ -109,11 +138,19 @@ jobs:
unique_tags_bak.txt
unique_reviewers_bak.txt
key: ${{ runner.os }}-auto-assign-reviewers-${{ steps.extract-pr.outputs.PR_NUMBER }}-${{ steps.changed_files.outputs.COMMENT_TIME }}

- name: Get approval status
id: get_approval
run: |
current_time=$(date -u +"%Y-%m-%d %H:%M UTC")
reviewers=$(cat unique_reviewers.txt | tr '\n' '|')

# 检查 unique_reviewers.txt 是否存在且非空
if [[ ! -s unique_reviewers.txt ]]; then
echo "No reviewers found, creating empty unique_reviewers.txt"
touch unique_reviewers.txt
fi

reviewers=$(cat unique_reviewers.txt | tr '\n' '|' | sed 's/|$//')

# 获取 PR 的所有评论
comments=$(curl -s \
Expand Down Expand Up @@ -169,7 +206,6 @@ jobs:

if [[ -n "${approvals[$reviewer]}" ]]; then
timestamp=$(date -d "${approvals[$reviewer]}" -u +"%Y-%m-%d %H:%M UTC")

echo "- ✅ **$formatted_reviewers** Reviewed On $timestamp"
else
echo "- ⌛ **$formatted_reviewers** Pending Review"
Expand All @@ -178,11 +214,15 @@ jobs:
} > review_status.md

echo "CURRENT_TIME=${current_time}" >> $GITHUB_OUTPUT

- name: Generate review data
id: generate_review
if: steps.generate_reviewers.outputs.HAS_REVIEWERS == 'true'
run: |
unique_tags=""
unique_tags=$(cat unique_tags.txt | xargs)
if [[ -s unique_tags.txt ]]; then
unique_tags=$(cat unique_tags.txt | xargs)
fi
unique_tags_bak=""
if [[ -f unique_tags_bak.txt ]]; then
unique_tags_bak=$(cat unique_tags_bak.txt | xargs)
Expand All @@ -199,7 +239,6 @@ jobs:

current_time=$(date -u +"%Y-%m-%d %H:%M UTC")
{

# 生成审查分配信息
echo "## 📌 Code Review Assignment"
echo ""
Expand Down Expand Up @@ -246,8 +285,10 @@ jobs:
echo "> ℹ️ **刷新CI状态操作需要具备仓库写入权限。**"
echo "> ℹ️ **Refresh CI status operation requires repository Write permission.**"
} > review_data.md

- name: Post/Update comment
id: post_comment
if: steps.generate_reviewers.outputs.HAS_REVIEWERS == 'true'
run: |
# 查找现有的 bot 评论
existing_comment=$(curl -s \
Expand All @@ -271,19 +312,23 @@ jobs:
-d "$(jq -n --arg body "$(cat review_data.md)" '{body: $body}')" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract-pr.outputs.PR_NUMBER }}/comments")
fi

- name: Get Comment Time
id: get_comment_time
if: steps.generate_reviewers.outputs.HAS_REVIEWERS == 'true'
run: |
existing_comment=$(curl -s \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract-pr.outputs.PR_NUMBER }}/comments" | \
jq -r '.[] | select(.user.login == "github-actions[bot]") | {body: .body} | @base64')
"https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract-pr.outputs.PR_NUMBER }}/comments" | \
jq -r '.[] | select(.user.login == "github-actions[bot]") | {body: .body} | @base64')
comment_body="${{ steps.get_approval.outputs.CURRENT_TIME }}"
comment_time=$(date -d "$comment_body" +%s)
echo "CURRENT_TIME=${comment_time}" >> $GITHUB_OUTPUT
cp unique_reviewers.txt unique_reviewers_bak.txt
cp unique_tags.txt unique_tags_bak.txt
- name: Restore Reviewers Save

- name: Save Reviewers Cache
id: reviewers-cache-save
if: steps.generate_reviewers.outputs.HAS_REVIEWERS == 'true'
uses: actions/cache/save@v4
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ path: .github
owners: supper thomas(supperthomas)<78900636@qq.com>, Bingru Zhang(Rbb666)<751061401@qq.com>, Yuqiang Wang(kurisaW)<2053731441@qq.com>

tag: stm32f407-rt-spark
path: bsp/stm32/stm32f407-rt-spark
path: bsp/stm32/stm32f407-rt-spark
owners: Bingru Zhang(Rbb666)<751061401@qq.com>, Yuqiang Wang(kurisaW)<2053731441@qq.com>

tag: libc
Expand Down
Loading