Skip to content

add github actions for code format checking. #2

add github actions for code format checking.

add github actions for code format checking. #2

Workflow file for this run

name: Code_Format_Check
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master", "ros2" ]
pull_request:
branches: [ "master", "ros2" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Removed the old artifacts
remove-old-artifacts:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: '15 days'
pre-commit:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a set of commands using the runners shell
- name: code_format_check
run: |
sudo apt-get install clang-format -y
find . -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs clang-format -i -style=file
git diff --exit-code