You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
Dart/Flutter Package Analyzer
v2.0.0
This action uses the pana (Package ANAlysis) package to compute the score that your Dart or Flutter package will have on the Pub site, and annotates your code, with suggestions for improvements.
This package, amongst other things:
- validates the code by performing static analysis with dartanalyzer,
- checks code formatting with
dartfmt
orflutter format
(detected automatically), - checks for outdated dependencies,
- validates the
pubspec.yaml
file (dependencies, description's length...), - checks for required files (
CHANGELOG
,README
,example
folder...) - ...
You must include the actions/checkout
step in your workflow. You don't need to run pub get
or build a Dart container before.
Here's an example:
name: Workflow example
on: [push, pull_request]
jobs:
package-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1 # required
- uses: axel-op/dart_package_analyzer@stable
with:
# Required:
githubToken: ${{ secrets.GITHUB_TOKEN }}
# Optional:
relativePath: packages/mypackage/
minAnnotationLevel: info
githubToken
input is required to post a report on GitHub. Note: the secretGITHUB_TOKEN
is already provided by GitHub and you don't have to set it up yourself.- If your package isn't at the root of the repository, use
relativePath
to indicate its location. - If you only want to see annotations for important errors, try to change the
minAnnotationLevel
parameter to another value. Accepted values areinfo
,warning
anderror
. Defaults toinfo
that posts all the annotations.
By default, this action uses the Dart SDK embedded in Flutter. It may not be the latest version of the Dart SDK. To use the latest version of the full Dart SDK, append /with_full_sdk
to the path of this action. This will slightly increase the time to pull the container that this action uses.
In the example above, you would edit line 10 like this:
- uses: axel-op/dart_package_analyzer/with_full_sdk@stable