Skip to content

Commit 45dba99

Browse files
committed
fix(workflow): 修复格式化工作流中的权限设置
1 parent 9ca1fa5 commit 45dba99

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

.github/workflows/format.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Format C++ Code
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
format:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Install clang-format
18+
run: sudo apt-get update && sudo apt-get install -y clang-format
19+
20+
- name: Run clang-format
21+
run: find src -name "*.h" -o -name "*.cpp" | xargs clang-format -i --style=file
22+
23+
- name: Commit changes
24+
uses: stefanzweifel/git-auto-commit-action@v4
25+
with:
26+
commit_message: "style: format code with clang-format"
27+
file_pattern: src/**/*.h src/**/*.cpp

0 commit comments

Comments
 (0)