Skip to content

Commit 07474a5

Browse files
committed
修复格式化机器人
1 parent 7fa544e commit 07474a5

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

.github/workflows/dotnet-format.yml

+27-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: Code format check
22
# 代码格式化机器人,详细请看 [dotnet 基于 dotnet format 的 GitHub Action 自动代码格式化机器人](https://blog.lindexi.com/post/dotnet-%E5%9F%BA%E4%BA%8E-dotnet-format-%E7%9A%84-GitHub-Action-%E8%87%AA%E5%8A%A8%E4%BB%A3%E7%A0%81%E6%A0%BC%E5%BC%8F%E5%8C%96%E6%9C%BA%E5%99%A8%E4%BA%BA.html )
33

4-
on: [push]
5-
4+
on:
5+
push:
6+
branches:
7+
- master
68
jobs:
79
dotnet-format:
810
runs-on: windows-latest
@@ -24,5 +26,26 @@ jobs:
2426

2527
- name: Run dotnet format
2628
run: dotnet format
27-
- name: Output Diff
28-
run: git diff
29+
30+
- name: Commit files
31+
# 下面将使用机器人的账号,你可以替换为你自己的账号
32+
run: |
33+
git config --local user.name "github-actions-dotnet-formatter[bot]"
34+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
35+
git commit -a -m 'Automated dotnet-format update'
36+
continue-on-error: true
37+
38+
- name: Create Pull Request
39+
# if: steps.format.outputs.has-changes == 'true' # 如果有格式化,才继续
40+
uses: peter-evans/create-pull-request@v3
41+
with:
42+
title: '[Bot] Automated PR to fix formatting errors'
43+
body: |
44+
Automated PR to fix formatting errors
45+
committer: GitHub <[email protected]>
46+
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
47+
# 以下是给定代码审查者,需要设置仓库有权限的开发者
48+
assignees: lindexi,walterlv
49+
reviewers: lindexi,walterlv
50+
# 对应的上传分支
51+
branch: t/bot/fix-codeformatting

0 commit comments

Comments
 (0)