From 2e836ac74b6c96856478b9027efdaa79125af4fc Mon Sep 17 00:00:00 2001 From: Madhura Bhave Date: Thu, 19 Apr 2018 10:37:40 -0700 Subject: [PATCH] Use token to prevent rate limiting by Github API --- ci/pipeline.yml | 6 ++++++ ci/scripts/determine-email-body.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 574c0eae13..66070f9224 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -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 diff --git a/ci/scripts/determine-email-body.sh b/ci/scripts/determine-email-body.sh index 1682e27f6d..b900f934b9 100755 --- a/ci/scripts/determine-email-body.sh +++ b/ci/scripts/determine-email-body.sh @@ -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 )