Skip to content

Commit

Permalink
fix: strip out a trailing \/n from input tokens (#1679)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu-codecov authored Nov 19, 2024
1 parent b542d5a commit 095cfe0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ runs:
else
if [ -n ${{ inputs.token }} ];
then
CC_TOKEN=${{ inputs.token }}
CC_TOKEN=$(echo ${{ inputs.token }} | tr -d '\n')

This comment has been minimized.

Copy link
@CarlosNihelton

CarlosNihelton Nov 21, 2024

This needs quoting CC_TOKEN=$(echo "${{ inputs.token }}" | tr -d '\n').

Without quotes the inputs.token is expanded when the script is composed, causing the newline to be rendered before the echo runs, like:

CC_TOKEN=$(echo ***
  
   | tr -d '\n')

That causes bash to throw syntax error. With quotes that wouldn't be a problem as the newline would be rendered as part of the argument of echo.

CC_TOKEN=$(echo "***
  
  " | tr -d '\n')
echo "CC_TOKEN=$CC_TOKEN" >> "$GITHUB_ENV"
fi
fi
Expand Down

0 comments on commit 095cfe0

Please sign in to comment.