Skip to content

Commit ca584a3

Browse files
author
lijianguo
committed
chore(addons): modify Deprecating API authentication through query parameters
1 parent fb70f01 commit ca584a3

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

scripts/push_release.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ GIT_REPO=$2
1111

1212
CREATE_RELEASE_DATA='{
1313
"tag_name": "'"${GIT_TAG}"'",
14-
"target_commitish": "master",
14+
"target_commitish": "main",
1515
"name": "'"${GIT_TAG}"'",
1616
"body": "release-'"${GIT_TAG}"'",
1717
"draft": false,
1818
"prerelease": false
1919
}'
2020

21-
echo "Creating a new release: $GIT_TAG branch: master"
21+
echo "Creating a new release: $GIT_TAG branch: main"
2222

23-
RESPONSE=$(curl -s --data "${CREATE_RELEASE_DATA}" "https://api.github.com/repos/$GIT_REPO/releases?access_token=${GITHUB_TOKEN}")
23+
RESPONSE=$(curl -s --data "${CREATE_RELEASE_DATA}" -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/$GIT_REPO/releases")
2424
ASSET_UPLOAD_URL=$(echo "$RESPONSE" | jq -r .upload_url | cut -d '{' -f1)
2525
if [ -z "$ASSET_UPLOAD_URL" ]; then
2626
echo ${RESPONSE}
@@ -29,5 +29,5 @@ fi
2929

3030
for FILE in toCopy/*; do
3131
echo "Uploading asset: $FILE to url: $ASSET_UPLOAD_URL?name=${FILE}"
32-
curl -s --data-binary @${FILE} -H "Content-Type: application/octet-stream" -X POST "$ASSET_UPLOAD_URL?name=$(basename ${FILE})&access_token=${GITHUB_TOKEN}"
32+
curl -s --data-binary @${FILE} -H "Content-Type: application/octet-stream" -H "Authorization: token ${GITHUB_TOKEN}" -X POST "$ASSET_UPLOAD_URL?name=$(basename ${FILE})"
3333
done

scripts/remove_latest_release.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ set -e
44
GIT_REPO=$1
55

66
echo "Getting latest release from $GIT_REPO"
7-
RESP=$(curl -s "https://api.github.com/repos/$GIT_REPO/releases/latest?access_token=${GITHUB_TOKEN}")
7+
RESP=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/$GIT_REPO/releases/latest")
88
URLS=$(echo "$RESP" | jq -r .url)
9-
if [ -z "${URLS}" ]; then
9+
if [ "${URLS}" ] && [ -z "${URLS}" ]; then
1010
echo ${RESP}
1111
exit 1
1212
fi
1313
RELEASE_URL=(${URLS// / })
1414

1515
echo "Deleting old latest release"
16-
RESPONSE=$(curl -s -X DELETE "${RELEASE_URL}?access_token=${GITHUB_TOKEN}")
16+
RESPONSE=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X DELETE "${RELEASE_URL}")
1717
echo ${RESPONSE}

0 commit comments

Comments
 (0)