Use token to prevent rate limiting by Github API

This commit is contained in:
Madhura Bhave 2018-04-19 10:37:40 -07:00
parent 5ecf33958c
commit 2e836ac74b
2 changed files with 7 additions and 1 deletions

View File

@ -145,6 +145,7 @@ jobs:
BUILD_PIPELINE_NAME: ((pipeline-name))
BUILD_JOB_NAME: build
CONCOURSE_URL: ((concourse-url))
ACCESS_TOKEN: ((github-access-token))
- put: email-notification
params:
subject: email-details/subject
@ -158,6 +159,7 @@ jobs:
BUILD_PIPELINE_NAME: ((pipeline-name))
BUILD_JOB_NAME: build
CONCOURSE_URL: ((concourse-url))
ACCESS_TOKEN: ((github-access-token))
- put: repo-status-build
params: { state: "success", commit: "git-repo" }
- put: email-notification
@ -220,6 +222,7 @@ jobs:
BUILD_PIPELINE_NAME: ((pipeline-name))
BUILD_JOB_NAME: jdk9-build
CONCOURSE_URL: ((concourse-url))
ACCESS_TOKEN: ((github-access-token))
- put: email-notification
params:
subject: email-details/subject
@ -233,6 +236,7 @@ jobs:
BUILD_PIPELINE_NAME: ((pipeline-name))
BUILD_JOB_NAME: jdk9-build
CONCOURSE_URL: ((concourse-url))
ACCESS_TOKEN: ((github-access-token))
- put: repo-status-jdk9-build
params: { state: "success", commit: "git-repo" }
- put: email-notification
@ -279,6 +283,7 @@ jobs:
BUILD_PIPELINE_NAME: ((pipeline-name))
BUILD_JOB_NAME: jdk10-build
CONCOURSE_URL: ((concourse-url))
ACCESS_TOKEN: ((github-access-token))
- put: email-notification
params:
subject: email-details/subject
@ -292,6 +297,7 @@ jobs:
BUILD_PIPELINE_NAME: ((pipeline-name))
BUILD_JOB_NAME: jdk10-build
CONCOURSE_URL: ((concourse-url))
ACCESS_TOKEN: ((github-access-token))
- put: repo-status-jdk10-build
params: { state: "success", commit: "git-repo" }
- put: email-notification

View File

@ -4,7 +4,7 @@ set -e
pushd git-repo > /dev/null
PREV_SHA=$( git rev-parse HEAD^1 )
popd > /dev/null
PREV_STATUSES=$( curl https://api.github.com/repos/spring-projects/spring-boot/commits/$PREV_SHA/statuses )
PREV_STATUSES=$( curl https://api.github.com/repos/spring-projects/spring-boot/commits/$PREV_SHA/statuses -H "Authorization: token ${ACCESS_TOKEN}" )
PREV_STATES=$( echo $PREV_STATUSES | jq -r --arg BUILD_JOB_NAME "$BUILD_JOB_NAME" '.[] | select(.context == $BUILD_JOB_NAME) | .state' )
WAS_PREV_SUCCESSFUL=$( echo "$PREV_STATES" | grep 'success' || true )