Step1: 创建 workflows yaml文件
- .github/workflows/clang_format.yml
Setp2: 编写代码格式检测 Action
name: clang_format
on: [push, pull_request]
paths-ignore: ## 也可以添加 ignore, 避免不必要的触发
- '**.md'
- 'LICENSE'
- '.gitignore'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 'clang-format check'
uses: DoozyX/clang-format-lint-action@v0.8
with:
source: './src'
extensions: 'h,cpp'
exclude: './doc'
clangFormatVersion: 6
本文介绍如何使用 GitHub Actions 和 Clang Format 实现 C/C++ 代码的自动格式检查。通过创建 clang_format.yml 文件并配置相关参数,可以实现 push 代码时自动执行格式检查,确保代码风格的一致性。
800

被折叠的 条评论
为什么被折叠?



