Skip to content

Commit 2c09969

Browse files
committed
reflect output var as exit code
1 parent e2e66e1 commit 2c09969

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

.github/workflows/cpp-linter.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ jobs:
1313
- uses: actions/checkout@v3
1414
- uses: cpp-linter/cpp-linter-action@composite-action
1515
id: linter
16+
continue-on-error: true
1617
env:
1718
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1819
with:
1920
style: file
2021
files-changed-only: false
22+
quiet-fail: false
2123

2224
- name: Fail fast?!
23-
if: steps.linter.outputs.checks-failed > 0
25+
if: steps.linter.outcome == 'failure'
2426
run: |
2527
echo "Some files failed the linting checks!"
2628
# for actual deployment

action.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ inputs:
7474
description: The directory containing compile_commands.json file.
7575
required: false
7676
default: ""
77-
outputs:
78-
checks-failed:
79-
description: An integer that can be used as a boolean value to indicate if all checks failed.
80-
value: ${{ steps.set-checks-failed.outputs.checks-failed }}
77+
quiet-fail:
78+
description: A flag that can be used to exit with a non-successfull error code (not '0') if any checks failed.
79+
required: false
80+
default: true
8181
runs:
8282
using: "composite"
8383
steps:
@@ -105,3 +105,7 @@ runs:
105105
--ignore="${{ inputs.ignore }}" \
106106
--database=${{ inputs.database }} \
107107
--file-annotations=${{ inputs.file-annotations }}
108+
- name: set output variable
109+
if: steps.cpp-linter.outputs.checks-failed != 0 && inputs.quiet-fail != 'true'
110+
shell: bash
111+
run: exit 1

0 commit comments

Comments
 (0)