Code Monkey home page Code Monkey logo

coverdiff's Introduction

Coverdiff Github Action

This action generates Golang test coverage profile for the PR branch and the base branch, compares results and leaves the coverage difference summary comment in the PR.

Action that adds test coverage comment in a PR:

name: Test coverage report
concurrency:
  cancel-in-progress: true
  group: coverdiff-${{ github.ref }}

on: [pull_request]

permissions:
  contents: read
  pull-requests: write

jobs:
  main:
    name: Coverage
    runs-on: ubuntu-latest
    steps:
    - name: Go cover diff
      uses: kskitek/[email protected]

See test repository with examples

coverage report

Permissions / Troubleshooting

You might stumble upon an error Resource not accessible by integration, in case that happens, fix GHA permissions.

Because default permissions are read only and the commenter action needs write permissions to PRs. you have to either:

  • Set workflow permissions in github repository settings under Actions/General to allow all more permissive permissions workflow permissions

  • Set more granular permissions using YAML. Learn more. Example:

permissions:
  contents: read
  pull-requests: write
  • Use GITHUB_TOKEN env with Personal Access Token - probably ok'ish solution only in one-man projects but consult GH documentation first.

Special thanks

to the maintainers of thollander/actions-comment-pull-request for full featured comment action!

coverdiff's People

Contributors

kskitek avatar

Watchers

 avatar

coverdiff's Issues

Handle first commit issue

When in the history there was no go package before the PR, the go test ./... fails with error go: warning: "./..." matched no packages

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.