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

add score_diff_string output, for easier use in templates #7

Merged
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
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ The score is the total number of occurrences of `<code></code>` blocks in the ba


### Outputs
| Output | Description |
|------------|-------------------------------------------------------------|
| base_score | Baseline score at base_ref |
| head_score | Baseline score at head_ref |
| score_diff | Difference between the two scores (head_score - base_score) |
| Output | Description |
|-------------------|-----------------------------------------------------------------|
| base_score | Baseline score at base_ref |
| head_score | Baseline score at head_ref |
| score_diff | Difference between the two scores (head_score - base_score) |
| score_diff_string | 'Same a `score_diff`, with a `+` prepended for positive numbers |

## Examples

Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ outputs:
description: 'Baseline score for the pull request head'
score_diff:
description: 'Difference between the two scores (head_score - base_score)'
score_diff_string:
description: 'Same as `score_diff`, with a `+` prepended for positive numbers'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ echo "base_score: $BASE_SCORE"

# Check if scores are different
SCORE_DIFF=$((HEAD_SCORE - BASE_SCORE))
SCORE_DIFF_STRING=$(printf '%+d' $SCORE_DIFF)

# Set outputs
{
echo "base_score=$BASE_SCORE"
echo "head_score=$HEAD_SCORE"
echo "score_diff=$SCORE_DIFF"
echo "score_diff_string=$SCORE_DIFF_STRING"
} >>"$GITHUB_OUTPUT"