Skip to content

Commit

Permalink
Merge pull request #7 from annervisser/add-scorediffstring-output-for…
Browse files Browse the repository at this point in the history
…-easier-use-in-templates

add score_diff_string output, for easier use in templates
  • Loading branch information
annervisser committed Feb 20, 2023
2 parents de8418b + 5926e3c commit 9a5d04d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
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"

0 comments on commit 9a5d04d

Please sign in to comment.