Skip to content

Merge branch 'release-70' into release-71 #359

Merge branch 'release-70' into release-71

Merge branch 'release-70' into release-71 #359

Workflow file for this run

name: Rubocop
on:
push:
branches:
- '*'
- '**/*'
concurrency:
group: ${{ github.ref }}-rubocop
cancel-in-progress: true
jobs:
rubocop:
name: Rubocop
# Containers must run in Linux based operating systems
runs-on: ubuntu-20.04
# Docker Hub image that the job executes in
container: ruby:3.1.6-alpine3.20
steps:
- name: Install git
run: |
apk add --no-cache git
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: dependencies
name: Set up dependencies
run: |
apk add --no-cache $(cat .github/dependencies.txt)
# ensure changed-files can read repo files from git
- name: Configure Git Safe Directory
run: git config --global --add safe.directory /__w/boston-cas/boston-cas
- name: cache gems
uses: actions/cache@v4
id: gemcache
with:
path: |
vendor/bundle
/usr/local/bundle/
key: ${{ runner.os }}-gemcache-${{ hashFiles('**/Gemfile.lock') }}-${{ hashFiles('**/.ruby-version') }}
- id: gems
name: Install gems
run: |
gem install bundler --version=2.5.17
bundle config set --local without 'production staging'
bundle install --jobs 4 --retry 3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
- id: rubocop
name: Run Rubocop
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
# Ignore files we don't control the format of
ignore_patterns="db/schema.rb\|bin/rails\|bin/rake\|bin/bundle"
files=`echo "${ALL_CHANGED_FILES}" | tr " " "\n" | grep -v $ignore_patterns | grep "**/*.rb" | tr "\n" " ./"`
num=`echo $files | wc -w`
echo $files
if [ $num -gt 0 ]; then bundle exec rubocop --config ./.rubocop.yml $files; else echo "No changed ruby files"; fi