openmv/.github/workflows/codeformat.yml
iabdalkader dcf18709ff github: Update workflows.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-04-17 11:30:07 +02:00

70 lines
1.6 KiB
YAML

name: '🔎 Check Code Formatting'
on:
push:
branches:
- 'master'
paths:
- '**/*.{c,cc,h}'
pull_request:
types:
- opened
- edited
- reopened
- synchronize
branches:
- 'master'
paths:
- '**/*.{c,cc,h}'
jobs:
formatting-check:
runs-on: ubuntu-24.04
steps:
- name: '⏳ Checkout repository'
uses: actions/checkout@v4
with:
submodules: false
persist-credentials: false
- name: '♻ Caching dependencies'
uses: actions/cache@v4.2.0
id: cache
with:
path: ~/cache/deps/bin
key: 'uncrustify'
- name: '🛠 Install dependencies'
if: steps.cache.outputs.cache-hit != 'true'
run: source tools/ci.sh && ci_install_code_format_deps
- name: '📜 Get list of changed files'
id: changed-files
uses: tj-actions/changed-files@v46
with:
files: |
**/*.{c,cc,h}
!cubeai/**
!docker/**
!docs/**
!drivers/**
drivers/sensors/*.{c,cc,h}
!lib/**
lib/imlib/*.{c,cc,h}
lib/tflm/*.{c,cc,h}
!scripts/**
!tools/**
!ports/stm32/uvc/**
- name: '📜 Show list of changed files'
run: |
echo "${{ toJSON(steps.changed-files.outputs) }}"
shell:
bash
- name: '🔎 Check code formatting'
if: steps.changed-files.outputs.any_changed == 'true'
run: |
source tools/ci.sh && ci_run_code_format_check ${{ steps.changed-files.outputs.all_changed_files }}