Merge pull request #1803 from houdiniproject/dependabot/bundler/ruby-… #672
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# License: LGPL-3.0-or-later | |
name: Code scanning | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, reopened, synchronize] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
# this version used for running various tools | |
tool_node_version: "16.x" | |
tool_ruby_version: "3.0.7" | |
jobs: | |
eslint: | |
runs-on: ubuntu-latest | |
name: Run eslint scanning | |
permissions: | |
contents: read | |
security-events: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-packages | |
with: | |
node: ${{ env.tool_node_version }} | |
- name: Install eslint formatter | |
run: | | |
yarn add @microsoft/[email protected] | |
- name: Run ESLint | |
run: yarn eslint | |
--format @microsoft/eslint-formatter-sarif | |
--output-file eslint-results.sarif | |
continue-on-error: true | |
- name: Upload analysis results to GitHub | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: eslint-results.sarif | |
wait-for-processing: true | |
rubocop: | |
name: Run rubocop | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
security-events: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-packages | |
with: | |
ruby: ${{ env.tool_ruby_version }} | |
- name: Allow adding the code-scanning-rubocop gem | |
run: bundle config unset deployment | |
- name: Install Code Scanning integration | |
run: bundle add code-scanning-rubocop --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@v3 | |
with: | |
sarif_file: rubocop.sarif |