Skip to content

style: run clang format (#488) #173

style: run clang format (#488)

style: run clang format (#488) #173

# Run clang-format
# This workflow runs clang-format to format C++ code and then creates
# a pull request to commit the changed files to the main branch.
# More details about clang-format can be found here:
# https://clang.llvm.org/docs/ClangFormat.html. To style
# C++ code in VS Code locally, you could follow the instructions on this
# website https://code.visualstudio.com/docs/editor/codebasics#_formatting
# to format the entire file or selected text.
name: run-clang-format
on:
workflow_dispatch:
# Runs the workflow on each push to the main or master branch:
push:
branches:
- main
jobs:
job:
name: run-clang-format
runs-on: ubuntu-latest
# Format hpp and cpp files under inst/include, src/, and test/gtest
# We use Google style to format code.
steps:
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.14
with:
source: './inst/include ./src ./tests/gtest'
extensions: 'hpp, cpp'
clangFormatVersion: 13.0.0
style: Google
inplace: True
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: 'style: run clang format'
token: ${{ secrets.PAT }}
branch: format-c++-code
title: 'format C++ code with clang format'
body: |
Auto-generated by [run-clang-format.yml][1]
[1]: https://github.com/NOAA-FIMS/FIMS/blob/main/.github/workflows/run-clang-format.yml