Skip to content

Update lint-format.yml #23

Update lint-format.yml

Update lint-format.yml #23

Workflow file for this run

name: Replace primitive types with fixed-width types
on: [push, pull_request]
jobs:
lint-format-replace:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install clang-format
run: sudo apt-get install clang-format
- name: Run clang-format
run: |
find . -name '*.c' -o -name '*.h' | xargs clang-format -i --style=file
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: '13'
check-path: 'src'
fallback-style: 'GNU'
- name: Replace primitive types with fixed-width types
run: |
find . -name '*.c' | xargs sed -i 's/\bunsigned long\b/u64/g'
find . -name '*.c' | xargs sed -i 's/\blong\b/s64/g'
find . -name '*.c' | xargs sed -i 's/\bunsigned int\b/u32/g'
find . -name '*.c' | xargs sed -i 's/\bint\b/s32/g'
find . -name '*.c' | xargs sed -i 's/\bunsigned short\b/u16/g'
find . -name '*.c' | xargs sed -i 's/\bshort\b/s16/g'
- name: Check if any files were changed
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git diff --exit-code || (git add . && git commit -m "Replace primitives types with fixed-width types and format files" && git push)