touch up README; clean up error
This commit is contained in:
parent
7fd77fa64b
commit
4dcfaf559a
10
README.md
10
README.md
|
@ -1,14 +1,16 @@
|
|||
Create a user on Gogs for posting build notifications (like 'buildbot') and generate a token for it. Insert the token as a drone secret.
|
||||
Create a user on Gogs for posting build notifications (like 'buildbot') and generate a token for it. Insert the token as a drone secret. (Replace $VALUE with the actual token)
|
||||
|
||||
drone secret add dan/gogs-notify-test --name gogs_account_token --value $VALUE --event pull-request --event push --event tag --event deployment
|
||||
drone secret add dan/gogs-notify-test --name gogs_account_token --value $VALUE --event pull_request
|
||||
|
||||
Use in drone.yml:
|
||||
Use in .drone.yml:
|
||||
|
||||
notify-gogs:
|
||||
image: mindstab/drone-gogs
|
||||
when:
|
||||
event: pull_request
|
||||
secrets: [gogs_account_token]
|
||||
gogs_url: https://git.openprivacy.ca
|
||||
gogs_url: https://git.yourdomain.com
|
||||
|
||||
- gogs_url should not end in '/'. Example with path: https://git.yourdomain.com/gogs
|
||||
|
||||
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
URL="$PLUGIN_GOGS_URL/api/v1/repos/$DRONE_REPO/issues/$DRONE_PULL_REQUEST/comments"
|
||||
|
||||
RESULT=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GOGS_ACCOUNT_TOKEN" -H "Content-Type: application/json" -d "{\"Body\": \"Drone Build Status: $DRONE_BUILD_STATUS\n\n$DRONE_BUILD_LINK\"}" -X POST $URL)
|
||||
CURL_RESULT=$?
|
||||
|
||||
if [ $RESULT -eq 201 ]
|
||||
then
|
||||
echo "Success posting to $URL"
|
||||
else
|
||||
echo "ERROR posting to $URL"
|
||||
echo "ERROR http: $RESULT curl: $CURL_RESULT"
|
||||
echo "ERROR HTTP $RESULT posting to $URL"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue