Skip to content

Commit

Permalink
Refactor linting steps, use reviewdog action
Browse files Browse the repository at this point in the history
  • Loading branch information
Kagemaru committed Jan 24, 2024
1 parent a682d78 commit d237ff1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 42 deletions.
69 changes: 28 additions & 41 deletions .github/workflows/reusable-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,31 @@ jobs:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: 'Set up Reviewdog'
env:
REVIEWDOG_INSTALLER: 'https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh'
run: |
mkdir -p $HOME/bin
curl -sfL ${REVIEWDOG_INSTALLER} | sh -s -- -b $HOME/bin
- name: 'Set up Rubocop'
run: 'gem install rubocop rubocop-minitest rubocop-performance rubocop-rails'

- name: 'Run Rubocop'
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rubocop |
$HOME/bin/reviewdog \
-f=rubocop \
-name="Rubocop" \
-reporter=github-pr-review \
-level=error \
-diff="git diff $DIFF_BRANCH"
- name: 'Set up Haml-lint'
run: 'gem install haml-lint'

- name: 'Run Haml-lint'
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
haml-lint |
$HOME/bin/reviewdog \
-efm="%f:%l %m" \
-name="Haml-lint" \
-reporter=github-pr-review \
-level=error \
-diff="git diff $DIFF_BRANCH"
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-minitest:gemfile rubocop-performance:gemfile rubocop-rails:gemfile
reporter: github-pr-review
level: error

- run: 'gem install haml-lint'

- uses: reviewdog/action-setup@v1

- name: 'Run Reviewdog HAML-Lint'
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
run: |
haml-lint |
reviewdog \
-efm="%f:%l %m" \
-name="HAML-Lint" \
-reporter=github-pr-review \
-level=error \
-diff="git diff $DIFF_BRANCH"
2 changes: 1 addition & 1 deletion .github/workflows/reusable-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
ports: [ '11211:11211' ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
Expand Down

0 comments on commit d237ff1

Please sign in to comment.