GithubHelp home page GithubHelp logo

cafuego / coverage-monitor-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from slavcodev/coverage-monitor-action

0.0 0.0 0.0 2.09 MB

A GitHub Action that monitor coverage.

License: MIT License

Shell 0.20% JavaScript 7.69% TypeScript 92.11%

coverage-monitor-action's Introduction

Coverage monitor

Status Latest Version License License

A GitHub Action that monitor coverage.

Usage

Pre-requisites

Create a workflow .yml file in your repositories .github/workflows directory.

Inputs

Options Description
github_token Required. The GITHUB_TOKEN secret.
coverage_path Required. Path to coverage reports.
coverage_format Format of coverage, supported: auto, clover and json-summary. Defaults to auto.
working_dir The working directory of the action. Defaults to workflow workspace.
clover_file Deprecated. Path to Clover XML file. Prefer coverage_path instead of clover_file.
threshold_alert Mark the build as unstable when coverage is less than this threshold. Defaults to 50.
threshold_warning Warning when coverage is less than this threshold. Defaults to 90.
threshold_metric A metric to check threshold on, supported: statements, lines, methods or branches. Defaults to lines.
check Whether check the coverage thresholds. Default to true. Ignored when event does not support checks, is not pull_request.
status_context A string label to differentiate this status from the status of other systems. Defaults to Coverage Report.
comment Whether comment the coverage report. Default to true. Ignored when event does not support comments, is not pull_request.
comment_context A string label to differentiate the comment posted by this action. Defaults to Coverage Report.
comment_mode A mode for comments, supported: replace, update or insert. Defaults to replace.
comment_footer Whether comment may contain footer. Defaults to true.

Example workflow

name: Tests
on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1

      - name: Test
        run: npm test

      - name: Monitor coverage
        uses: slavcodev/coverage-monitor-action@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          coverage_path: "logs/clover.xml"
          threshold_alert: 10
          threshold_warning: 50
          threshold_metric: "lines"

Permissions for the GITHUB_TOKEN

The secret GITHUB_TOKEN is granted with some permissions, and in some cases the action may fail to post the comment or the check status, for example on Dependabot pull-requests. You can follow instructions from Using the GITHUB_TOKEN in a workflow guid how to set up permissions.

You also can work around the issue with using the action with conditions, for example:

name: Tests
on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Monitor coverage
        if: ! contains(github.event.pull_request.user.login, 'dependabot[bot]')
        uses: slavcodev/coverage-monitor-action@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          coverage_path: "logs/clover.xml"

Preview

Screenshot Screenshot

Contributing

We would love for you to contribute, pull requests are welcome! Please see the CONTRIBUTING.md for more information.

License

MIT License

coverage-monitor-action's People

Contributors

dependabot[bot] avatar slavcodev avatar mawi12345 avatar szikszail avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.