Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/test/using_bundler/Gemfile
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ruby/setup-ruby@922ebc4c5262cd14e07bb0e1db020984b6c064fe # v1.226.0
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
bundler-cache: true
Expand All @@ -21,5 +21,7 @@ jobs:
github_token: ${{ secrets.github_token }}
skip_install: 'true'
use_bundler: 'true'
reporter: github-pr-annotations
fail_level: warning
- run: |
test "$(bundle exec erb_lint --version)" == "0.9.0"
8 changes: 4 additions & 4 deletions .github/workflows/depup.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: depup
on:
schedule:
- cron: "14 14 * * *" # Runs at 14:14 UTC every day
- cron: '14 14 * * *' # Runs at 14:14 UTC every day
repository_dispatch:
types: [depup]

jobs:
reviewdog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: haya14busa/action-depup@d6b40096afad49ca676145faaba7190df29a9807 # v1.6.3
- uses: actions/checkout@v6
- uses: reviewdog/action-depup@v1
id: depup
with:
file: action.yml
version_name: REVIEWDOG_VERSION
repo: reviewdog/reviewdog

- name: Create Pull Request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}"
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
tags:
- "v*.*.*"
- 'v*.*.*'
pull_request:
types:
- labeled
Expand All @@ -14,35 +14,34 @@ jobs:
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@v6

# Bump version on merging Pull Requests with specific labels.
# (bump:major,bump:minor,bump:patch)
- id: bumpr
if: "!startsWith(github.ref, 'refs/tags/')"
uses: haya14busa/action-bumpr@78ab5a104d20896c9c9122c64221b3aecf1a8cbb # v1.10.0
uses: haya14busa/action-bumpr@v1

# Update corresponding major and minor tag.
# e.g. Update v1 and v1.2 when releasing v1.2.3
- uses: haya14busa/action-update-semver@fb48464b2438ae82cc78237be61afb4f461265a1 # v1.2.1
- uses: haya14busa/action-update-semver@v1
if: "!steps.bumpr.outputs.skip"
with:
tag: ${{ steps.bumpr.outputs.next_version }}

# Get tag name.
- id: tag
uses: haya14busa/action-cond@94f77f7a80cd666cb3155084e428254fea4281fd # v1.2.1
uses: haya14busa/action-cond@v1
with:
cond: "${{ startsWith(github.ref, 'refs/tags/') }}"
if_true: ${{ github.ref }}
if_false: ${{ steps.bumpr.outputs.next_version }}

# Create release
# Create release.
- if: "steps.tag.outputs.value != ''"
env:
TAG_NAME: ${{ steps.tag.outputs.value }}
BODY: ${{ steps.bumpr.outputs.message }}
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${TAG_NAME}" -t "Release ${TAG_NAME/refs\/tags\//}" --notes "${BODY}"
Expand All @@ -51,6 +50,6 @@ jobs:
if: github.event.action == 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@v6
- name: Post bumpr status comment
uses: haya14busa/action-bumpr@78ab5a104d20896c9c9122c64221b3aecf1a8cbb # v1.10.0
uses: haya14busa/action-bumpr@v1
61 changes: 44 additions & 17 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,66 @@
name: reviewdog
on: [pull_request]

jobs:
# Use shellcheck to lint shell scripts
shellcheck:
name: runner / shellcheck
misspell:
name: check / misspell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: shellcheck
uses: reviewdog/action-shellcheck@6e0e63d1750d02d761b3df0f2c5ba9f9ac4a9ed7 # v1.29.0
- uses: actions/checkout@v6
- name: misspell
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-annotations
fail_level: any
locale: "US"

# Use misspell to correct spelling mistakes
misspell:
name: runner / misspell
shellcheck:
name: runner / shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: misspell
uses: reviewdog/action-misspell@18ffb61effb93b47e332f185216be7e49592e7e1 # v1.26.1
- uses: actions/checkout@v6
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
locale: "US"
reporter: github-pr-annotations
fail_level: any
path: "."
pattern: "*.sh"
exclude: "./.git/*"

# Use yamllint to lint yaml files
yamllint:
name: check / yamllint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@v6
- name: yamllint
uses: reviewdog/action-yamllint@1dca3ad811867be18fbe293a9818d715a6c2cd46 # v1.20.0
uses: reviewdog/action-yamllint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
reporter: github-pr-annotations
fail_level: any
yamllint_flags: '-d "{extends: default, rules: {truthy: disable}}" .'

actionlint:
name: runner / actionlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: reviewdog/action-actionlint@v1
with:
reporter: github-pr-annotations
fail_level: error
level: warning

alex:
name: runner / alex
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: reviewdog/action-alex@v1
with:
reporter: github-pr-annotations
fail_level: error
level: warning
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Wizard Health
Copyright (c) 2023 Wizard Health, codeur

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
57 changes: 40 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GitHub Action: Run erb_lint with reviewdog 🐶

[![](https://img.shields.io/github/license/codeur/action-erblint)](./LICENSE)
[![reviewdog](https://github.com/codeur/action-erblint/workflows/reviewdog/badge.svg)](https://github.com/codeur/action-erblint/actions?query=workflow%3Areviewdog)
[![depup](https://github.com/codeur/action-erblint/workflows/depup/badge.svg)](https://github.com/codeur/action-erblint/actions?query=workflow%3Adepup)
[![release](https://github.com/codeur/action-erblint/workflows/release/badge.svg)](https://github.com/codeur/action-erblint/actions?query=workflow%3Arelease)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/codeur/action-erblint?logo=github&sort=semver)](https://github.com/codeur/action-erblint/releases)
Expand Down Expand Up @@ -30,18 +31,17 @@ With `reporter: github-pr-review` a comment is added to the Pull Request Convers

`GITHUB_TOKEN`. Default is `${{ github.token }}`.

### `erblint_version`
### `erblint_flags`

Optional. erb_lint flags. (erb_lint --quiet --format tabs --no-exit-on-warn --no-exit-on-error `<erblint_flags>`)

Optional. Set erb_lint version.
### `erblint_version`

Optional. Set erb_lint version. Possible values:
- empty or omit: install latest version
- `gemfile`: install version from Gemfile (`Gemfile.lock` should be presented, otherwise it will fallback to latest bundler version)
- version (e.g. `0.9.0`): install said version

### `erblint_flags`

Optional. erb_lint flags. (erb_lint --quiet --format tabs --no-exit-on-warn --no-exit-on-error `<erblint_flags>`)

### `tool_name`

Optional. Tool name to use for reviewdog reporter. Useful when running multiple
Expand All @@ -57,6 +57,17 @@ It's same as `-level` flag of reviewdog.
Optional. Reporter of reviewdog command [`github-pr-check`, `github-pr-review`].
The default is `github-pr-check`.

### `fail_level`

Optional. If set to `none`, always use exit code 0 for reviewdog. Otherwise, exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to the given level.
Possible values: [`none`, `any`, `info`, `warning`, `error`].
Default is `none`.

### `fail_on_error`

Optional. Deprecated, use `fail_level` instead. Exit code for reviewdog when errors are found [`true`, `false`].
Default is `false`.

### `filter_mode`

Optional. Filtering mode for the reviewdog command [`added`, `diff_context`, `file`, `nofilter`].
Expand All @@ -66,10 +77,6 @@ Default is `added`.

Optional. Additional reviewdog flags.

### `workdir`

Optional. The directory from which to look for and run erb_lint. Default `.`.

### `skip_install`

Optional. Do not install erb_lint. Default: `false`.
Expand All @@ -78,9 +85,13 @@ Optional. Do not install erb_lint. Default: `false`.

Optional. Run erb_lint with bundle exec. Default: `false`.

### `workdir`

Optional. The directory from which to look for and run erb_lint. Default `.`.

## Example usage

```yml
```yaml
name: reviewdog
on: [pull_request]
jobs:
Expand All @@ -89,18 +100,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@1a615958ad9d422dd932dc1d5823942ee002799f # v1.227.0
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4.5
ruby-version: 3.4
- name: erb_lint
uses: codeur/action-erblint@5083efd49634e26645a0736681b618ccc3fb7f14 # v2.19.2
uses: codeur/action-erblint@v2
with:
erblint_version: 0.9.0
reporter: github-pr-review # Default is github-pr-check
erblint_version: gemfile
reporter: github-pr-review
```

## Dev

### Release new version

1. Create a Pull Request with changes.
2. Add one of the following labels to the PR:
- `bump:major`: Bump major version (e.g. v1.0.0 -> v2.0.0)
- `bump:minor`: Bump minor version (e.g. v1.0.0 -> v1.1.0)
- `bump:patch`: Bump patch version (e.g. v1.0.0 -> v1.0.1)
3. Merge the PR.
4. The release workflow will automatically bump the version, create a release, and update major/minor tags (e.g. v1).

## License

[MIT](https://choosealicense.com/licenses/mit)
Loading