Skip to content

Commit

Permalink
chore: move repo owner (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
kilianc authored May 13, 2024
1 parent 43a4d52 commit 958e841
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: make test

- name: Go Beautiful HTML Coverage
uses: 'kilianc/go-beautiful-html-coverage@v1'
uses: 'gha-common/go-beautiful-html-coverage@v1'
```
## How it works
Expand All @@ -43,31 +43,31 @@ This GHA expects two files to be present in the root of your repo at runtime:
- `cover.txt` is the output of `go tool cover -func=cover.out -o cover.txt`
- `cover.html` is the output of `go tool cover -html=cover.out -o cover.html`

Both `go tool cover` commands can be configured to your liking. For examples on how you might do that you can peak at [`Makefile`](go-test-app/Makefile), or some of my other go projects like [`pretender`](https://github.com/kilianc/pretender/blob/main/Makefile#L44-L57) and [`base-go-cli`](https://github.com/kilianc/base-golang-cli/blob/main/Makefile#L76-L92).
Both `go tool cover` commands can be configured to your liking. For examples on how you might do that you can peak at [`Makefile`](go-test-app/Makefile), or some of my other go projects like [`pretender`](https://github.com/gha-common/pretender/blob/main/Makefile#L44-L57) and [`base-go-cli`](https://github.com/gha-common/base-golang-cli/blob/main/Makefile#L76-L92).

Once the files are generated, the GHA does the following:

1. Create and push [new orphan branch](https://github.com/kilianc/go-beautiful-html-coverage/tree/cover) if one doesn't exist.
1. Create and push [new orphan branch](https://github.com/gha-common/go-beautiful-html-coverage/tree/cover) if one doesn't exist.
1. Customize `cover.html` with [`nord.css`](assets/nord.css) and rename it `<sha>.html`.
1. `git-push` the `<sha>.html` file to the orphan branch. This will trigger a `GitHub Pages` deployment.
1. Post a comment to your PR with your code coverage summary (`cover.txt`) and a link to your `<sha>.html`.

### Screenshots

<br>
<img width="912" alt="PR Comment" src="https://github.com/kilianc/go-beautiful-html-coverage/assets/385716/99b01c85-f573-44cb-b554-64e9495aa7d1">
<img width="822" alt="HTML Preview" src="https://github.com/kilianc/go-beautiful-html-coverage/assets/385716/bb4361f3-34db-4c9d-9970-794d3dded7b9">
<img width="912" alt="PR Comment" src="https://github.com/gha-common/go-beautiful-html-coverage/assets/385716/99b01c85-f573-44cb-b554-64e9495aa7d1">
<img width="822" alt="HTML Preview" src="https://github.com/gha-common/go-beautiful-html-coverage/assets/385716/bb4361f3-34db-4c9d-9970-794d3dded7b9">

> [!NOTE]
> In order for the HTML preview links to work, configure `GitHub Pages` in your target repo *(`Settings > Pages`)* to `Deploy from a branch` and pick your target branch, which is, by default, `cover`.
>
> ![GitHub Pages Setup](https://github.com/kilianc/go-beautiful-html-coverage/assets/385716/a14f4df6-6263-4ae3-8685-e7901a1dbbe2)
> ![GitHub Pages Setup](https://github.com/gha-common/go-beautiful-html-coverage/assets/385716/a14f4df6-6263-4ae3-8685-e7901a1dbbe2)

## Reference

```yaml
- name: Go Beautiful HTML Coverage
uses: 'kilianc/go-beautiful-html-coverage@v1'
uses: 'gha-common/go-beautiful-html-coverage@v1'
with:
# Repository name with owner. For example, actions/checkout.
# Default: ${{ github.repository }}
Expand All @@ -88,7 +88,7 @@ Once the files are generated, the GHA does the following:

```yaml
- name: Go Beautiful HTML Coverage
uses: 'kilianc/go-beautiful-html-coverage@v1'
uses: 'gha-common/go-beautiful-html-coverage@v1'
with:
branch: 'my-coverage'
```
Expand All @@ -101,7 +101,7 @@ This is helpful if you don't want to clutter your project's repo, or if you want

```yaml
- name: Go Beautiful HTML Coverage
uses: 'kilianc/go-beautiful-html-coverage@v1'
uses: 'gha-common/go-beautiful-html-coverage@v1'
with:
repository: yourname/coverage
token: ${{ secrets.GHA_COVERAGE_TOKEN }}
Expand Down

0 comments on commit 958e841

Please sign in to comment.