review is now just a comment. Something is erroring after some change...
This commit is contained in:
parent
7e766025ae
commit
8663653ec3
|
|
@ -15,33 +15,25 @@ spec:
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
# Approve or request changes.
|
|
||||||
echo '{"userId" : 1, "requestId" : 1, "status" : "PENDING",
|
|
||||||
"statusDate" : ""}' > request.json
|
|
||||||
cat request.json | jq ".userId = $TEKTON_USER_ID" | jq . > request1.json
|
|
||||||
cat request1.json | jq ".requestId = $(params.pr-id)" | jq . > request2.json
|
|
||||||
cat request2.json | jq ".statusDate = \"`date +"%Y-%m-%dT%H:%M:%S%:z"`\"" | jq . > request3.json
|
|
||||||
|
|
||||||
|
STATUS=""
|
||||||
case "$(params.status)" in
|
case "$(params.status)" in
|
||||||
"Succeeded" | "Completed")
|
"Succeeded" | "Completed")
|
||||||
echo "Build was successful!"
|
echo "Build was successful!"
|
||||||
cat request3.json | jq ".status = \"APPROVED\" " | jq . > request4.json
|
STATUS="Sucess! :) "
|
||||||
;;
|
;;
|
||||||
"Failed" | "None")
|
"Failed" | "None")
|
||||||
cat request3.json | jq ".status = \"REQUESTED_FOR_CHANGES\" " | jq . > request4.json
|
STATUS="Error! :( "
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
curl -u tekton:$TEKTON_API_KEY \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d@request4.json \
|
|
||||||
$(params.feedback-url)/~api/pull-request-reviews
|
|
||||||
# Make a comment on the PR.
|
# Make a comment on the PR.
|
||||||
echo '{"userId" : 1, "requestId" : 1, "content" : "",
|
echo '{"userId" : 1, "requestId" : 1, "content" : "",
|
||||||
"date" : ""}' > comment.json
|
"date" : ""}' > comment.json
|
||||||
cat comment.json | jq ".userId = $TEKTON_USER_ID" | jq . > comment1.json
|
cat comment.json | jq ".userId = $TEKTON_USER_ID" | jq . > comment1.json
|
||||||
cat comment1.json | jq ".requestId = $(params.pr-id)" | jq . > comment2.json
|
cat comment1.json | jq ".requestId = $(params.pr-id)" | jq . > comment2.json
|
||||||
cat comment2.json | jq ".date = \"`date +"%Y-%m-%dT%H:%M:%S%:z"`\"" | jq . > comment3.json
|
cat comment2.json | jq ".date = \"`date +"%Y-%m-%dT%H:%M:%S%:z"`\"" | jq . > comment3.json
|
||||||
cat comment3.json | jq ".content = \"Tekton run: $(params.run-name).\"" | jq . > comment4.json
|
cat comment3.json | jq ".content = \"$STATUS Tekton run: $(params.run-name).\"" | jq . > comment4.json
|
||||||
curl -u tekton:$TEKTON_API_KEY \
|
curl -u tekton:$TEKTON_API_KEY \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d@comment4.json \
|
-d@comment4.json \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue