diff --git a/README.md b/README.md index c591ba1..c0178a0 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,12 @@ The score is the total number of occurrences of `` 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 diff --git a/action.yml b/action.yml index e95f9c7..1cad48d 100644 --- a/action.yml +++ b/action.yml @@ -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' diff --git a/entrypoint.sh b/entrypoint.sh index 3c01793..a46e5cf 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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"