Skip to content

Commit

Permalink
reflect output var as exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Aug 24, 2022
1 parent e2e66e1 commit 2c09969
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/cpp-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ jobs:
- uses: actions/checkout@v3
- uses: cpp-linter/cpp-linter-action@composite-action
id: linter
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file
files-changed-only: false
quiet-fail: false

- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
if: steps.linter.outcome == 'failure'
run: |
echo "Some files failed the linting checks!"
# for actual deployment
Expand Down
12 changes: 8 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ inputs:
description: The directory containing compile_commands.json file.
required: false
default: ""
outputs:
checks-failed:
description: An integer that can be used as a boolean value to indicate if all checks failed.
value: ${{ steps.set-checks-failed.outputs.checks-failed }}
quiet-fail:
description: A flag that can be used to exit with a non-successfull error code (not '0') if any checks failed.
required: false
default: true
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -105,3 +105,7 @@ runs:
--ignore="${{ inputs.ignore }}" \
--database=${{ inputs.database }} \
--file-annotations=${{ inputs.file-annotations }}
- name: set output variable
if: steps.cpp-linter.outputs.checks-failed != 0 && inputs.quiet-fail != 'true'
shell: bash
run: exit 1

0 comments on commit 2c09969

Please sign in to comment.