Skip to content

Commit 847484e

Browse files
authored
Merge pull request #54 from lucassabreu/issue/53
chore: explaning fork limitations
2 parents 5c16829 + 6c64fa6 commit 847484e

File tree

9 files changed

+184
-44
lines changed

9 files changed

+184
-44
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin/* linguist-generated

.github/workflows/summary-example.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: example of summary
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
build:
7+
name: example of workflow
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@master
12+
13+
- name: clover file to comment (clover.example.base.xml)
14+
uses: ./.
15+
with:
16+
dir-prefix: /var/www/html
17+
file: clover.example.base.xml
18+
base-file: clover.example.xml
19+
chart-size: 75
20+
only-with-cover: true
21+
signature: "summary example"

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- explanation about forks and token permissions with them.
12+
- new option `skip-comments-on-forks` to prevent blocking pull requests from forks because of lack of
13+
permissions.
14+
15+
### Changed
16+
17+
- improving error reporting for debugging purposes
18+
919
## [0.12.0] - 2024-02-02
1020

1121
### Added

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Configuration
5454
| `table-coverage-change` | Show only files which their coverage changed equal or above this percentage <br/> Default: `0` |
5555
| `signature` | Custom signature to be used at the bottom of the comment. <br/>If you need multiple comments per pull request each step needs to have a unique `signature` |
5656
| `github-token` | Custom [PAT][pat] to be used instead of the [default action token][default-token], should have the `repo` scope |
57+
| `skip-comments-on-forks` | Should skip trying to comment on [pull requests created from forks](#restrictions-on-forks) <br/> Default: `false` |
5758

5859
Example usage
5960
-------------
@@ -155,10 +156,25 @@ jobs:
155156
base-file: tests/base/coverage.xml
156157
```
157158
159+
Restrictions on Forks
160+
---------------------
161+
162+
Github Actions [imposes higher Restrictions on workflows triggered from forks in public repositories][fork],
163+
where the default token generated will have only read permissions.
164+
165+
Because of that when this Action is run on pull requests from forks no comment will be created with the
166+
coverage report, instead the report will only be shown at the steps summary.
167+
168+
![example of step summary with the report](./assets/summary-example.png)
169+
170+
If comments on pull request from forks are required for your workflow a [PAT](pat) can be used, but be aware
171+
that doing that may open the owner of the PAT to the malicious intentions of the internet.
172+
158173
[CHANGELOG](CHANGELOG.md)
159174
---------
160175
161176
[danhunsaker/clover-reporter-action]: https://github.com/danhunsaker/clover-reporter-action
162177
[pat]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
163178
[lang]: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Intl#argumento_locales
164179
[default-token]: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
180+
[fork]: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ inputs:
7373
signature:
7474
description: Custom signature to be used at the bottom of the comment
7575
required: false
76+
skip-comments-on-forks:
77+
description: Should skip trying to comment on pull requests created from forks
78+
default: false
79+
7680
runs:
7781
using: node20
7882
main: bin/index.js

assets/summary-example.png

50 KB
Loading

bin/index.js

Lines changed: 69 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)