diff --git a/README.md b/README.md index 7eb461a..5b04818 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,44 @@ This action runs [go-patch-cover](https://github.com/seriousben/go-patch-cover) to display test coverage for code changed within a pull request. +![Comment example](docs/comment-example.png#gh-dark-mode-only) +![Comment example](docs/comment-example-light.png#gh-light-mode-only) + +## Permissions + +- `pull-requests: write` for writing comments on pull requests. +- `contents: write` for the git-notes prev_coverage_mode to maintain the coverage within git notes. + +## Usage + +Just add `seriousben/go-patch-cover-action` as a step in your existing workflow. + +A workflow might look like this: + +```yaml +name: "CI" + +on: ["push", "pull_request"] + +permissions: + contents: write + pull-requests: write + +jobs: + ci: + name: "Run CI" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: WillAbides/setup-go-faster@v1.7.0 + with: + go-version: "*" + - run: "go test -coverprofile=coverage.out -covermode=count ./..." + - uses: seriousben/go-patch-cover-action@v1.0.0 + with: + version: main +``` + +Please see [GitHub's documentation on Actions](https://docs.github.com/en/actions) for extensive +documentation on how to write and tweak workflows. + diff --git a/action.yaml b/action.yaml index 0c0bd3f..abf0c0c 100644 --- a/action.yaml +++ b/action.yaml @@ -1,10 +1,6 @@ name: "Go Patch Coverage" description: | Display golang patch test coverage on your pull requests. - - Required permissions: - - `pull-requests: write` for writing comments on pull requests. - - `contents: write` for the git-notes prev_coverage_mode to maintain the coverage within git notes. author: "Benjamin Boudreau" branding: icon: "code" @@ -149,4 +145,4 @@ runs: git push origin refs/notes/coverage shell: bash env: - coverage_filename : ${{ inputs.coverage_filename }} \ No newline at end of file + coverage_filename : ${{ inputs.coverage_filename }} diff --git a/docs/comment-example-light.png b/docs/comment-example-light.png new file mode 100644 index 0000000..3ada562 Binary files /dev/null and b/docs/comment-example-light.png differ diff --git a/docs/comment-example.png b/docs/comment-example.png new file mode 100644 index 0000000..798cb60 Binary files /dev/null and b/docs/comment-example.png differ