YDA-5623: fail workflow if code is not properly formatted #19
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |