Skip to content

Commit 3c240f4

Browse files
committed
Delete newlines from base64-encoded blob
1 parent 32227a5 commit 3c240f4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

create-blob.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,24 @@ set -e
33

44
# Path to file containing blob contents
55
path="${1}"
6-
base64 -i "${path}"
76

87
# Encode blob contents
98
content=$( mktemp )
10-
base64 -i "${path}" | jq --raw-input '.' > $content
11-
cat $content
9+
base64 "${path}" | tr -d '\n' | jq --raw-input '.' > $content
1210

1311
# # Generate payload
1412
payload=$( mktemp )
1513
jq --null-input \
1614
--arg encoding "base64" \
1715
--argfile content "$content" \
1816
'{"content": $content, "encoding": $encoding}' > $payload
19-
cat $payload
2017

2118
# Create blob
2219
response=$( curl --silent --request POST \
2320
--url https://api.github.com/repos/$GITHUB_REPOSITORY/git/blobs \
2421
--header "authorization: Bearer $GH_TOKEN" \
2522
--header 'content-type: application/json' \
2623
--data @$payload )
27-
echo "$response"
2824

29-
# # Export environment variables with object ids
30-
# echo BLOB_SHA=$( jq -r '.sha' <<< "${response}" ) >> $GITHUB_ENV
25+
# Export environment variables with object ids
26+
echo BLOB_SHA=$( jq -r '.sha' <<< "${response}" ) >> $GITHUB_ENV

0 commit comments

Comments
 (0)