Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow custom icons #58

Merged
merged 5 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,31 @@ jobs:
with-branches: false
signature: "comment using a pat"
github-token: ${{ secrets.PAT }}

- name: comment using custom icons
uses: ./.
with:
dir-prefix: /var/www/html
file: clover.onepackage.xml
base-file: clover.onepackage.base.xml
with-chart: true
show-percentage-change-on-table: true
signature: "comment using custom icons"
icon-equals: ":eject_button:"
icon-increased: ":arrow_upper_right:"
icon-decreased: ":arrow_lower_right:"
icon-new: ":checkered_flag:"

- name: comment using text instead of icons
uses: ./.
with:
dir-prefix: /var/www/html
file: clover.onepackage.xml
base-file: clover.onepackage.base.xml
with-chart: true
show-percentage-change-on-table: true
icon-equals: "(same)"
icon-increased: "(increased)"
icon-decreased: "(decreased)"
icon-new: "(new)"
signature: "comment using text instead of icons"
54 changes: 29 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,35 @@ File: `clover.example.base.xml`
Configuration
-------------

| Input | Description |
|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `file` | The location of the clover file. <br/> **Required** |
| `base-file` | The location of the clover file with a previous state of the coverage to compare |
| `dir-prefix` | Section of the file on clover report to remove <br/> Default: `github.workspace` <br/> **Required** |
| `dir-prefix-keep` | Section of the `dir-prefix` to keep when creating link to file.<br/>Example: if your php application is at "$REPO/backend", then you should set this to "backend" |
| `only-with-cover` | Should only list files with at least one line covered. |
| `only-with-coverable-lines` | Should only list files with at least one "coverable" line of code<br/>Example: interfaces or abstract classes with no implementation |
| `lang` | In which [language][lang] to format the numbers <br/> Default: `en-US` |
| `chart-size` | How many characters to use on chart's bar<br/> Default: `23` |
| `with-chart` | Add a chart with the distribution of coverage on files<br/> Default: `true` |
| `max-line-coverage-decrease` | How much the line coverage percentage can decrease without failing |
| `max-method-coverage-decrease` | How much the method coverage percentage can decrease without failing |
| `min-line-coverage` | Minimum percentage acceptable for line coverage <br/> Default: `0` |
| `min-method-coverage` | Minimum percentage acceptable for method coverage <br/>Default `0` |
| `with-table` | Add a table with a list of files and its coverage <br/> Default: `true` |
| `with-branches` | Adds the column "Branches" with the branching coverage <br/> Default: `true` |
| `show-percentage-change-on-table` | Show in percentage how much the file coverage changed per file |
| `table-type-coverage` | Which of the coverage percentages to filter <br/> Default: `"lines"` |
| `table-below-coverage` | Show only files below or equal to this coverage percentage <br/> Default: `100` |
| `table-above-coverage` | Show only files above or equal to this coverage percentage <br/> Default: `0` |
| `table-coverage-change` | Show only files which their coverage changed equal or above this percentage <br/> Default: `0` |
| `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` |
| `github-token` | Custom [PAT][pat] to be used instead of the [default action token][default-token], should have the `repo` scope |
| `skip-comments-on-forks` | Should skip trying to comment on [pull requests created from forks](#restrictions-on-forks) <br/> Default: `false` |
| Input | Description |
|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `file` | The location of the clover file. <br/> **Required** |
| `base-file` | The location of the clover file with a previous state of the coverage to compare |
| `dir-prefix` | Section of the file on clover report to remove <br/> Default: `github.workspace` <br/> **Required** |
| `dir-prefix-keep` | Section of the `dir-prefix` to keep when creating link to file.<br/>Example: if your php application is at "$REPO/backend", then you should set this to "backend" |
| `only-with-cover` | Should only list files with at least one line covered. |
| `only-with-coverable-lines` | Should only list files with at least one "coverable" line of code<br/>Example: interfaces or abstract classes with no implementation |
| `lang` | In which [language][lang] to format the numbers <br/> Default: `en-US` |
| `chart-size` | How many characters to use on chart's bar<br/> Default: `23` |
| `with-chart` | Add a chart with the distribution of coverage on files<br/> Default: `true` |
| `max-line-coverage-decrease` | How much the line coverage percentage can decrease without failing |
| `max-method-coverage-decrease` | How much the method coverage percentage can decrease without failing |
| `min-line-coverage` | Minimum percentage acceptable for line coverage <br/> Default: `0` |
| `min-method-coverage` | Minimum percentage acceptable for method coverage <br/>Default `0` |
| `with-table` | Add a table with a list of files and its coverage <br/> Default: `true` |
| `with-branches` | Adds the column "Branches" with the branching coverage <br/> Default: `true` |
| `show-percentage-change-on-table` | Show in percentage how much the file coverage changed per file |
| `table-type-coverage` | Which of the coverage percentages to filter <br/> Default: `"lines"` |
| `table-below-coverage` | Show only files below or equal to this coverage percentage <br/> Default: `100` |
| `table-above-coverage` | Show only files above or equal to this coverage percentage <br/> Default: `0` |
| `table-coverage-change` | Show only files which their coverage changed equal or above this percentage <br/> Default: `0` |
| `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` |
| `github-token` | Custom [PAT][pat] to be used instead of the [default action token][default-token], should have the `repo` scope |
| `skip-comments-on-forks` | Should skip trying to comment on [pull requests created from forks](#restrictions-on-forks) <br/> Default: `false` |
| `icon-equals` | Emoji/text to be used when the coverage diff is zero <br/> Default: `:stop_button:` |
| `icon-increased` | Emoji/text to be used when the coverage diff is increased <br/> Default: `:stop_up_small:` |
| `icon-decreased` | Emoji/text to be used when the coverage diff is decreased <br/> Default: `:stop_down_small:` |
| `icon-new` | Emoji/text to be used when the file file is new, and does not have previous coverage metrics to compare <br/> Default: `:new:` |

Example usage
-------------
Expand Down
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ inputs:
skip-comments-on-forks:
description: Should skip trying to comment on pull requests created from forks
default: false
icon-equals:
description: Emoji/text to be used when the coverage diff is zero
default: ":stop_button:"
icon-increased:
description: Emoji/text to be used when the coverage diff is increased
default: ":stop_up_small:"
icon-decreased:
description: Emoji/text to be used when the coverage diff is decreased
default: ":stop_down_small:"
icon-new:
description: Emoji/text to be used when the file file is new, and does not have previous coverage metrics to compare
default: ":new:"

runs:
using: node20
Expand Down
45 changes: 27 additions & 18 deletions bin/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/index.js.map

Large diffs are not rendered by default.

Loading
Loading