| # A CI configuration to check PR health. Check the docs at https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose#health. |
| |
| name: Health |
| |
| # Callers of this workflow should use it as follows: |
| # |
| # name: Health |
| # on: |
| # pull_request: |
| # branches: [ main ] |
| # types: [opened, synchronize, reopened, labeled, unlabeled] |
| # jobs: |
| # health: |
| # uses: dart-lang/ecosystem/.github/workflows/health.yaml@main |
| |
| |
| # Or with options: |
| # |
| # jobs: |
| # health: |
| # uses: dart-lang/ecosystem/.github/workflows/health.yaml@main |
| # with: |
| # sdk: beta |
| # checks: "version,changelog,license,coverage,breaking,do-not-submit,leaking" |
| # fail_on: "version,changelog,do-not-submit" |
| # warn_on: "license,coverage,breaking,leaking" |
| # coverage_web: false |
| # upload_coverage: false |
| # use-flutter: true |
| # use-flutter: true |
| # use-flutter: true |
| # ignore_license: "**.g.dart" |
| # ignore_coverage: "**.mock.dart,**.g.dart" |
| # ignore_packages: "pkgs/helper_package" |
| # checkout_submodules: false |
| # experiments: "native-assets" |
| |
| on: |
| workflow_call: |
| inputs: |
| # Callers may optionally specify the version of the SDK to use when running the |
| # health check. This can be useful if your package has a very recent minimum SDK |
| # constraint. This is done via the `sdk` input parameter. Note that this |
| # parameter is not required; it defaults to `stable` - using the most recent |
| # stable release of the Dart SDK. |
| sdk: |
| description: >- |
| The channel, or a specific version from a channel, to install |
| ('2.19.0','stable', 'beta', 'dev'). Using one of the three channels |
| will give you the latest version published to that channel. |
| default: "stable" |
| required: false |
| type: string |
| # Restrict the checks to any subset of version, changelog, and license if |
| # needed. |
| checks: |
| description: What to check for in the PR health check - any subset of "version,changelog,license,coverage,breaking,do-not-submit,leaking" |
| default: "version,changelog,license,coverage,breaking,do-not-submit,leaking" |
| type: string |
| required: false |
| fail_on: |
| description: Which checks should lead to failure - any subset of "version,changelog,license,coverage,breaking,do-not-submit,leaking" |
| default: "version,changelog,do-not-submit" |
| type: string |
| required: false |
| warn_on: |
| description: Which checks should not fail, but only warn - any subset of "version,changelog,license,coverage,breaking,do-not-submit,leaking" |
| default: "license,coverage,breaking,leaking" |
| type: string |
| required: false |
| local_debug: |
| description: Whether to use a local copy of package:firehose - only for debug |
| default: false |
| type: boolean |
| required: false |
| upload_coverage: |
| description: Whether to upload the coverage to coveralls |
| default: true |
| type: boolean |
| required: false |
| coverage_web: |
| description: Whether to run `dart test -p chrome` for coverage |
| default: false |
| type: boolean |
| required: false |
| use-flutter: |
| description: Whether to setup Flutter in this workflow. |
| default: false |
| required: false |
| type: boolean |
| ignore_license: |
| description: Which files to ignore for the license check. |
| default: "\"\"" |
| required: false |
| type: string |
| ignore_coverage: |
| description: Which files to ignore for the coverage check. |
| default: "\"\"" |
| required: false |
| type: string |
| ignore_packages: |
| description: Which packages to ignore. |
| default: "\"\"" |
| required: false |
| type: string |
| checkout_submodules: |
| description: Whether to checkout submodules of git repositories. |
| default: false |
| required: false |
| type: boolean |
| experiments: |
| description: Which experiments should be enabled for Dart. |
| default: "\"\"" |
| type: string |
| required: false |
| |
| jobs: |
| version: |
| if: ${{ contains(inputs.checks, 'version') }} |
| uses: ./.github/workflows/health_base.yaml |
| with: |
| sdk: ${{ inputs.sdk }} |
| check: version |
| fail_on: ${{ inputs.fail_on }} |
| warn_on: ${{ inputs.warn_on }} |
| local_debug: ${{ inputs.local_debug }} |
| use-flutter: ${{ inputs.use-flutter }} |
| ignore_packages: ${{ inputs.ignore_packages }} |
| checkout_submodules: ${{ inputs.checkout_submodules }} |
| |
| changelog: |
| if: ${{ contains(inputs.checks, 'changelog') }} |
| uses: ./.github/workflows/health_base.yaml |
| with: |
| sdk: ${{ inputs.sdk }} |
| check: changelog |
| fail_on: ${{ inputs.fail_on }} |
| warn_on: ${{ inputs.warn_on }} |
| local_debug: ${{ inputs.local_debug }} |
| use-flutter: ${{ inputs.use-flutter }} |
| ignore_packages: ${{ inputs.ignore_packages }} |
| checkout_submodules: ${{ inputs.checkout_submodules }} |
| |
| license: |
| if: ${{ contains(inputs.checks, 'license') }} |
| uses: ./.github/workflows/health_base.yaml |
| with: |
| sdk: ${{ inputs.sdk }} |
| check: license |
| fail_on: ${{ inputs.fail_on }} |
| warn_on: ${{ inputs.warn_on }} |
| local_debug: ${{ inputs.local_debug }} |
| use-flutter: ${{ inputs.use-flutter }} |
| ignore_license: ${{ inputs.ignore_license }} |
| ignore_packages: ${{ inputs.ignore_packages }} |
| checkout_submodules: ${{ inputs.checkout_submodules }} |
| |
| coverage: |
| if: ${{ contains(inputs.checks, 'coverage') }} |
| uses: ./.github/workflows/health_base.yaml |
| with: |
| sdk: ${{ inputs.sdk }} |
| check: coverage |
| fail_on: ${{ inputs.fail_on }} |
| warn_on: ${{ inputs.warn_on }} |
| upload_coverage: ${{ inputs.upload_coverage }} |
| coverage_web: ${{ inputs.coverage_web }} |
| local_debug: ${{ inputs.local_debug }} |
| use-flutter: ${{ inputs.use-flutter }} |
| ignore_coverage: ${{ inputs.ignore_coverage }} |
| ignore_packages: ${{ inputs.ignore_packages }} |
| checkout_submodules: ${{ inputs.checkout_submodules }} |
| experiments: ${{ inputs.experiments }} |
| |
| breaking: |
| if: ${{ contains(inputs.checks, 'breaking') }} |
| uses: ./.github/workflows/health_base.yaml |
| with: |
| sdk: ${{ inputs.sdk }} |
| check: breaking |
| fail_on: ${{ inputs.fail_on }} |
| warn_on: ${{ inputs.warn_on }} |
| local_debug: ${{ inputs.local_debug }} |
| use-flutter: ${{ inputs.use-flutter }} |
| ignore_packages: ${{ inputs.ignore_packages }} |
| checkout_submodules: ${{ inputs.checkout_submodules }} |
| |
| do-not-submit: |
| if: ${{ contains(inputs.checks, 'do-not-submit') }} |
| uses: ./.github/workflows/health_base.yaml |
| with: |
| sdk: ${{ inputs.sdk }} |
| check: do-not-submit |
| fail_on: ${{ inputs.fail_on }} |
| warn_on: ${{ inputs.warn_on }} |
| local_debug: ${{ inputs.local_debug }} |
| use-flutter: ${{ inputs.use-flutter }} |
| ignore_packages: ${{ inputs.ignore_packages }} |
| checkout_submodules: ${{ inputs.checkout_submodules }} |
| |
| leaking: |
| if: ${{ contains(inputs.checks, 'leaking') }} |
| uses: ./.github/workflows/health_base.yaml |
| with: |
| sdk: ${{ inputs.sdk }} |
| check: leaking |
| fail_on: ${{ inputs.fail_on }} |
| warn_on: ${{ inputs.warn_on }} |
| local_debug: ${{ inputs.local_debug }} |
| use-flutter: ${{ inputs.use-flutter }} |
| ignore_packages: ${{ inputs.ignore_packages }} |
| checkout_submodules: ${{ inputs.checkout_submodules }} |
| |
| comment: |
| needs: [version, changelog, license, coverage, breaking, do-not-submit, leaking] |
| if: always() |
| # These permissions are required for us to create comments on PRs. |
| permissions: |
| pull-requests: write |
| |
| runs-on: ubuntu-latest |
| |
| steps: |
| - name: Download All Artifacts |
| uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e |
| with: |
| path: single-comments |
| |
| - run: ls -R single-comments |
| |
| - name: Find Comment |
| uses: peter-evans/find-comment@bf21a578dd780f2e451dac9c1aa40a64c4285b75 |
| id: fc |
| with: |
| issue-number: ${{ github.event.number }} |
| comment-author: github-actions[bot] |
| body-includes: '## PR Health' |
| |
| - name: Merge all single comments |
| run: | |
| mkdir output |
| echo $'## PR Health \n\n' >> output/comment.md |
| cat single-comments/*/*.md >> output/comment.md |
| echo ${{ github.event.number }} > output/issueNumber |
| |
| - name: Write comment id to file |
| if: ${{ steps.fc.outputs.comment-id != 0 }} |
| run: echo ${{ steps.fc.outputs.comment-id }} >> output/commentId |
| |
| - name: Upload folder with number and markdown |
| uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 |
| with: |
| name: output |
| path: output/ |