This action analyzes the modified lines dart code of the PR by running dart analyze
and dart format
.
Create a .yml
file in ./github/workflows/
in your project.
fail-on
: Specifies when the action should fail.- Options:
'error'
: Fails only on analyze error.'warning'
: Fails on warnings and errors.'info'
: Fails on info, warnings and errors fromdart analyze
.'format'
: Fails on everything, including bad formatting.'nothing'
: Fails on nothing.
- Optional.
- Default:
'error'
.
- Options:
working-directory
: The working directory.- Optional.
- Default:
'./'
.
token
: Github token- Optional.
- Default: Secret token provided by Github
check-renamed-files
: If set to'true'
, it will checks an entire renamed file even if there is no change in it.- Options:
'false'
,'true'
. - Optional.
- Default:
'false'
.
- Options:
emojis
:'false'
will remove the emojis from the comment.- Options:
'true'
,'false'
. - Optional.
- Default:
'true'
.
- Options:
format
:'false'
will remove the check on the format.- Options:
'true'
,'false'
. - Optional.
- Default:
'true'
.
- Options:
line-length
: The line length for dart format command.- Optional.
- Default: The default value used in
dart format
No output.
It will fail the checks on your Pull Requests if any issue is found:
It will leave a comment explaining why it failed and what issues it found:
In the code change, it will display errors and warnings where the issues are found:
on: [pull_request]
jobs:
linter:
runs-on: ubuntu-latest
name: Lint flutter code
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Flutter
uses: subosito/flutter-action@v2
- run: flutter pub get
- name: Analyze Flutter
uses: ValentinVignal/action-dart-analyze@v0.17
with:
fail-on: "warning"
In order to write comments, your GITHUB_TOKEN
might need the pull_request: write
permission.