From 52d7c2f2d625458c1732030a0c3fe54b52b0b817 Mon Sep 17 00:00:00 2001 From: HAHWUL Date: Tue, 31 Oct 2023 22:37:13 +0900 Subject: [PATCH] Update rubocop.yml --- .github/workflows/rubocop.yml | 46 ++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 60297b0..1dff612 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -1,16 +1,40 @@ -name: Linters +name: "Rubocop" -on: [push] +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] jobs: - build: + rubocop: runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: - - uses: actions/checkout@v1 - - name: RuboCop Linter - uses: andrewmcodes/rubocop-linter-action@v3.3.0 - with: - action_config_path: ".github/config/rubocop_linter_action.yml" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - \ No newline at end of file + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + + - name: Install Code Scanning integration + run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install + + - name: Install dependencies + run: bundle install + + - name: Rubocop run + run: | + bash -c " + bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif + [[ $? -ne 2 ]] + " + + - name: Upload Sarif output + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: rubocop.sarif