[ci][format] fix the issue of CLA verification interception
Some checks failed
ToolsCI / Tools (push) Has been cancelled
pkgs_test / change (push) Has been cancelled
utest_auto_run / A9 :components/dfs.cfg (push) Has been cancelled
utest_auto_run / A9 :components/lwip.cfg (push) Has been cancelled
utest_auto_run / A9 :components/netdev.cfg (push) Has been cancelled
utest_auto_run / A9 :components/sal.cfg (push) Has been cancelled
utest_auto_run / A9 :cpp11/cpp11.cfg (push) Has been cancelled
utest_auto_run / AARCH64-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / A9-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / XUANTIE-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64 :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64-smp :default.cfg (push) Has been cancelled
utest_auto_run / A9 :default.cfg (push) Has been cancelled
utest_auto_run / A9-smp :default.cfg (push) Has been cancelled
utest_auto_run / RISCV :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-smp :default.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / RISCV :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/ipc.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/kernel_basic.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/mem.cfg (push) Has been cancelled
Weekly CI Scheduler / Trigger and Monitor CIs (push) Has been cancelled
Weekly CI Scheduler / Create Discussion Report (push) Has been cancelled

This commit is contained in:
kurisaw
2026-03-20 15:24:43 +08:00
committed by Rbb666
parent f78bef1207
commit 4ca97e50dd

View File

@@ -52,8 +52,8 @@ jobs:
echo "📋 Checking supported features..."
clang-format --help | grep -i "align\|consecutive" || echo "No align/consecutive options found"
- name: Get changed files from PR
id: get-pr-files
- name: Get PR info (files and author)
id: get-pr-info
run: |
max_retries=3
retry_count=0
@@ -68,6 +68,24 @@ jobs:
exit 1
fi
echo "Fetching PR info for #$PR_NUMBER..."
# 获取PR的详细信息包括作者
pr_response=$(curl -s \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/RT-Thread/rt-thread/pulls/$PR_NUMBER")
# 获取PR作者的GitHub用户名
PR_AUTHOR=$(jq -r '.user.login' <<<"$pr_response")
echo "PR Author: $PR_AUTHOR"
# 使用GitHub noreply邮箱格式
PR_AUTHOR_EMAIL="${PR_AUTHOR}+github[bot]@noreply.github.com"
echo "pr_author=$PR_AUTHOR" >> $GITHUB_OUTPUT
echo "pr_author_email=$PR_AUTHOR_EMAIL" >> $GITHUB_OUTPUT
echo "Fetching changed files for PR #$PR_NUMBER..."
while [ $retry_count -lt $max_retries ]; do
@@ -123,7 +141,7 @@ jobs:
id: find-files
run: |
# 获取PR中修改的文件
CHANGED_FILES="${{ steps.get-pr-files.outputs.all_changed_files }}"
CHANGED_FILES="${{ steps.get-pr-info.outputs.all_changed_files }}"
# 将逗号分隔的文件列表转换为换行分隔
CHANGED_FILES_LINES=$(echo "$CHANGED_FILES" | tr ',' '\n')
@@ -250,8 +268,17 @@ jobs:
- name: Commit and push changes
if: steps.check-changes.outputs.has_changes == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# 使用PR作者作为commit author避免CLA检查失败
# CLA检查只识别PR作者已签署CLA而不识别github-actions[bot]
PR_AUTHOR="${{ steps.get-pr-info.outputs.pr_author }}"
PR_AUTHOR_EMAIL="${{ steps.get-pr-info.outputs.pr_author_email }}"
git config --local user.email "$PR_AUTHOR_EMAIL"
git config --local user.name "$PR_AUTHOR"
# 使用GIT_AUTHOR环境变量让commit以贡献者名义提交
export GIT_AUTHOR_NAME="$PR_AUTHOR"
export GIT_AUTHOR_EMAIL="$PR_AUTHOR_EMAIL"
git add -A
git commit -m "style: format code with clang-format [skip ci]"