Skip to content

Commit a80c0fe

Browse files
authored
ci: update check email (#3609)
1 parent aad0d1e commit a80c0fe

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

.github/workflows/pull-request.yml

+17-9
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,28 @@ jobs:
99
check-email:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
- name: check_github_primary_email
1414
run: |
15-
log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo "默认邮箱 $log_emails 校验非法,可以去 https://github.com/settings/emails 更改" && exit 2;else echo "邮箱 $log_emails 校验通过";fi
16-
- uses: actions/checkout@v3
17-
with:
18-
ref: ${{ github.event.pull_request.head.sha }}
19-
- name: check_local_email
20-
run: |
21-
log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo "本地提交邮箱 $log_emails 校验非法,需要本地更改重新提交" && exit 2;else echo "邮箱 $log_emails 校验通过";fi
15+
# 获取最新提交的作者邮箱和提交者邮箱
16+
log_emails=$(git log --pretty=format:"%ae %ce" -1)
17+
# 如果邮箱包含 'tdesign@tencent.com',跳过验证
18+
if [[ ${log_emails} =~ 'tdesign@tencent.com' ]];then
19+
echo "$log_emails 跳过验证"
20+
exit 0
21+
fi
22+
# 如果邮箱包含 '@tencent.com',校验失败,提示用户更改邮箱
23+
if [[ ${log_emails} =~ '@tencent.com' ]];then
24+
echo "默认邮箱 $log_emails 校验非法,可以去 https://github.com/settings/emails 更改"
25+
exit 2;
26+
else
27+
# 否则,校验通过
28+
echo "邮箱 $log_emails 校验通过";
29+
fi
2230
lint:
2331
runs-on: ubuntu-latest
2432
steps:
25-
- uses: actions/checkout@v2
33+
- uses: actions/checkout@v4
2634
- uses: ./.github/actions/install-dep
2735
- name: lint 检查
2836
run: npm run lint

0 commit comments

Comments
 (0)