Skip to content

Merge pull request #14 from Fantaskink/linter #28

Merge pull request #14 from Fantaskink/linter

Merge pull request #14 from Fantaskink/linter #28

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 src -name '*.c' -o -name '*.h' | xargs clang-format -i --style=file
- 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)