From 2c09969c6d2f42e4bad4608948cb04e07b9a6ab5 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Wed, 24 Aug 2022 03:04:34 -0700 Subject: [PATCH] reflect output var as exit code --- .github/workflows/cpp-linter.yml | 4 +++- action.yml | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index 821006b6..48dc36a5 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -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 diff --git a/action.yml b/action.yml index 0676eb4b..67197321 100644 --- a/action.yml +++ b/action.yml @@ -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: @@ -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