卷曲-无效的参数null

时间:2018-08-24 12:48:49

标签: bash shell curl

我试图制作一个脚本,以在travis-ci构建完成时发布请求。

我收到此错误:Invalid params null, 1668, https://github.com/HyperiumClient/Hyperium/releases/download/1668./build/libs/Hyperium-0.24.jar:1

代码:https://gist.github.com/Cubxity/457736a7bcbfe6d6f3ae2a5db04c0806

#!/bin/bash

if [ -z "$1" ]; then
  echo -e "WARNING!!\nYou need to pass the WEBHOOK_URL environment variable as the first argument to this script." && exit
fi

echo -e "[Webhook]: Sending webhook to Discord...\\n";

AUTHOR_NAME="$(git log -1 "$TRAVIS_COMMIT" --pretty="%aN")"
COMMITTER_NAME="$(git log -1 "$TRAVIS_COMMIT" --pretty="%cN")"
COMMIT_SUBJECT="$(git log -1 "$TRAVIS_COMMIT" --pretty="%s")"
COMMIT_MESSAGE="$(git log -1 "$TRAVIS_COMMIT" --pretty="%b")"

if [[ $TRAVIS_PULL_REQUEST != false ]]; then
  URL="https://github.com/$TRAVIS_REPO_SLUG/pull/$TRAVIS_PULL_REQUEST"
else
  URL=""
fi

TIMESTAMP=$(date --utc +%FT%TZ)
WEBHOOK_DATA='{
  "embeds": [ {
    "color": '3066993',
    "author": {
      "name": "Beta release (Build #'"$TRAVIS_BUILD_NUMBER"')",
      "url": "https://travis-ci.org/'"$TRAVIS_REPO_SLUG"'/builds/'"$TRAVIS_BUILD_ID"'",
      "icon_url": "https://travis-ci.org/images/logos/TravisCI-Mascot-blue.png"
    },
    "title": "'"$COMMIT_SUBJECT"'",
    "url": "'"$URL"'",
    "description": "'"${COMMIT_MESSAGE//$'\n'/ }"\\n\\n"https://github.com/HyperiumClient/Hyperium/releases/tag/$TRAVIS_BUILD_NUMBER"'",
    "timestamp": "'"$TIMESTAMP"'"
  } ]
}'

(curl --fail --progress-bar -A "TravisCI-Webhook" -H Content-Type:application/json -H X-Author:Cubxity#7801 -d "$WEBHOOK_DATA" "$1" \
  && echo -e "\\n[Webhook]: Successfully sent the webhook.") || echo -e "\\n[Webhook]: Unable to send webhook."

FILE_NAME=$(find .| grep Hyperium-):1

curl -d "url=https://github.com/HyperiumClient/Hyperium/releases/download/${TRAVIS_BUILD_NUMBER}$FILE_NAME&id=${TRAVIS_BUILD_NUMBER}&secret=${SECRET}&beta=true -H Content-Type: application/x-www-form-urlencoded" -X POST https://sk1er.club/user/hyperium_update

Travis配置:https://github.com/HyperiumClient/Hyperium/blob/master/.travis.yml

0 个答案:

没有答案