papermario/.github/workflows/lint.yaml

41 lines
960 B
YAML

name: Lint
on:
push:
paths:
- 'src/*'
- 'include/*'
pull_request:
paths:
- 'src/*'
- 'include/*'
jobs:
build:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo apt-get install -y astyle clang-tidy
# lint files changed by the push/pr
- id: files
uses: trilom/file-changes-action@v1.2.4
with:
output: ' '
continue-on-error: true
- run: ./format.sh ${{ steps.files.outputs.files}}
if: ${{ steps.files.outcome == 'success' }}
- run: ./format.sh
if: ${{ steps.files.outcome == 'failure' }}
# fail if any files were changed by ./format.sh
- id: files_formatted
uses: jackton1/find-changed-files@v1.1
with:
files: src, include
- name: Fail if any files reformatted
if: steps.files_formatted.outputs.files_changed == 'true'
run: exit 1