Skip to content

Commit

Permalink
fix: Enable URL encoding for badge links (#33)
Browse files Browse the repository at this point in the history
URL encode branch names.
Fixes #32
  • Loading branch information
cicdguy authored Nov 7, 2023
1 parent e9f4411 commit cdeaeb8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ runs:
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
if [[ "${{ steps.repository-visibility.outputs.result }}" == "public" ]]
then {
echo -e "![badge](https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ inputs.diff-storage }}/data/${{ env.diff_storage_branch }}/badge.svg)\n\n" > .coverage-output.final
# URL encoding for branch name
URL_ENCODED_BRANCH=$(python3 -c 'import urllib.parse; print(urllib.parse.quote_plus("${{ env.diff_storage_branch }}"))')
echo -e "![badge](https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ inputs.diff-storage }}/data/${URL_ENCODED_BRANCH}/badge.svg)\n\n" > .coverage-output.final
}
else {
echo -e "🧪 Test coverage: ${{ steps.coverage_percent.outputs.coverage_total }}%\n\n" > .coverage-output.final
Expand Down

0 comments on commit cdeaeb8

Please sign in to comment.