Skip to content

YDA-5623: fail workflow if code is not properly formatted #10

YDA-5623: fail workflow if code is not properly formatted

YDA-5623: fail workflow if code is not properly formatted #10

name: linter-irods-clang-format
on: [push, pull_request]
defaults:
run:
shell: bash
jobs:
clang-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install ClangFormat
run: |
sudo apt-get install -y clang-format
- name: Run ClangFormat
run: |
echo "warnings=$(clang-format -n src/* | wc -l)" >> "$GITHUB_ENV"

Check failure on line 19 in .github/workflows/linter-irods-clang-format.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/linter-irods-clang-format.yml

Invalid workflow file

You have an error in your yaml syntax on line 19
- run: |
echo "Source code is properly formatted.";
exit 0
if: "$warnings" == "0"
- run: |
echo "Source code needs to be formatted!";
exit 1
if: "$warnings" != "0"