Skip to content

Use list for parameter link #334

Use list for parameter link

Use list for parameter link #334

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Check Format
# 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 ]
pull_request:
branches: [ master ]
# 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:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: jitterbit/get-changed-files@v1
with:
# Format of the steps output context.
# Can be 'space-delimited', 'csv', or 'json'.
# Default: 'space-delimited'
format: 'space-delimited'
- name: Install Tools
shell: bash
run: |
sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-16 main"
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt update
sudo apt install clang-format-16
- id: files
uses: jitterbit/get-changed-files@v1
- run: |
changed_files=""
checked_suffix=(
*.c
*.h
*.cpp
*.hpp
)
exclude_path=(
rtos
src/lib
src/model
)
for file in ${{ steps.files.outputs.added_modified }}; do
need_check=0
for suffix in ${checked_suffix[*]}; do
if [[($file == $suffix)]]; then
need_check=1
fi
done
for path in ${exclude_path[*]}; do
if !(test -z $(echo $file | grep $path)); then
need_check=0
fi
done
if test $need_check -gt 0; then
changed_files="${changed_files} ${file}"
fi
done
if [ -n "${changed_files}" ]; then
clang-format-16 -n --style=file --Werror ${changed_files}
fi
echo "format-checked files: ${changed_files}."