diff --git a/action.yml b/action.yml index 87c0c83..adf7ef5 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,9 @@ name: Reclaim The Stack - Rubocop description: Runs rubocop and posts offences as inline PR comments. inputs: + failure_exit_code: + description: Exit code after running rubocop-- a non-zero exit code will fail the build + default: "108" github_token: description: GITHUB_TOKEN default: ${{ github.token }} @@ -16,5 +19,6 @@ runs: - run: ruby $GITHUB_ACTION_PATH/rubocop.rb ${{ inputs.rubocop_arguments }} shell: bash env: + FAILURE_EXIT_CODE: ${{ inputs.failure_exit_code }} GITHUB_TOKEN: ${{ inputs.github_token }} RUBOCOP_GEM_VERSIONS: ${{ inputs.gem_versions }} diff --git a/rubocop.rb b/rubocop.rb index 7a29453..ca7212a 100644 --- a/rubocop.rb +++ b/rubocop.rb @@ -192,5 +192,5 @@ def in_diff?(changed_files, path, line) if number_of_offenses > 0 puts "" puts "#{number_of_offenses} offenses found! Failing the build..." - exit 108 + exit ENV.fetch("FAILURE_EXIT_CODE", 108).to_i end