Skip to content

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

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

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

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"
- run: |
echo "Source code needs to be formatted! ${{ env.warnings }}";
exit 1
if: ${{ env.warnings != "0" }}

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

View workflow run for this annotation

GitHub Actions / linter-irods-clang-format

Invalid workflow file

The workflow is not valid. .github/workflows/linter-irods-clang-format.yml (Line: 23, Col: 13): Unexpected symbol: '"0"'. Located at position 17 within expression: env.warnings != "0"