Skip to content

Commit

Permalink
Print changed ruby files
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Nov 14, 2023
1 parent 74a397d commit 7515717
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,21 @@ jobs:
with:
ruby-version: 3.1.4
bundler-cache: true


# Deleted files are excluded
# adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
- name: Get changed ruby files (git diff)
run: |
changedFiles=$(git diff-tree --name-only --diff-filter=d -r HEAD^1 HEAD | grep '\.rb$')
echo "Changed ruby files: $changedFiles"
echo "CHANGED_FILES=$changedFiles" >> $GITHUB_ENV
# Scope Rubocop to changed files:
# https://robertfaldo.medium.com/commands-to-run-rubocop-and-specs-you-changed-in-your-branch-e6d2f2e4110b
# https://github.com/actions/checkout/issues/520#issuecomment-1167205721
# Exclude deleted files
- name: Run RuboCop
run: |
git diff-tree --name-only --diff-filter=d -r HEAD^1 HEAD | grep '\.rb$' | xargs bundle exec rubocop --parallel
$CHANGED_FILES | xargs bundle exec rubocop --parallel
# eslint:
Expand Down

0 comments on commit 7515717

Please sign in to comment.