Skip to content

Commit edacc31

Browse files
author
Justin
committed
fix(actions/gapic): allow optional cache setting
1 parent e563286 commit edacc31

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

actions/gapic/entrypoint.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ pushd $TEMP_GIT_GOOGLEAPIS
1818

1919
git clone --single-branch --branch master https://github.com/googleapis/googleapis.git .
2020

21-
set +x # WARNING: do not remove
22-
echo -n "${INPUT_CACHE_SERVICE_ACCOUNT}" > $GOOGLE_APPLICATION_CREDENTIALS
23-
24-
echo "build --remote_http_cache=https://storage.googleapis.com/${INPUT_CACHE_BUCKET}" >> .bazelrc
25-
echo "build --google_credentials=${GOOGLE_APPLICATION_CREDENTIALS}" >> .bazelrc
21+
set +x # WARNING: do not remove
22+
if [[ -z "${INPUT_CACHE_SERVICE_ACCOUNT}" ]]; then
23+
echo -n "${INPUT_CACHE_SERVICE_ACCOUNT}" >$GOOGLE_APPLICATION_CREDENTIALS
24+
echo "build --remote_http_cache=https://storage.googleapis.com/${INPUT_CACHE_BUCKET}" >>.bazelrc
25+
echo "build --google_credentials=${GOOGLE_APPLICATION_CREDENTIALS}" >>.bazelrc
26+
fi
2627

2728
bazel build $INPUT_TARGET
2829

@@ -45,18 +46,17 @@ git reset --hard origin/master
4546
# extract the tar to the correct location
4647
tar xf "${TEMP_GIT_GOOGLEAPIS}/bazel-bin/${TARGET_OUTPUT}" --strip-components $INPUT_TAR_STRIP_COMPONENTS $INPUT_TAR_PATH
4748

48-
4949
# commit the changes if any to the branch
5050
if [[ -n $(git status -s -uall) ]]; then
5151
git add -A
5252
git commit -m 'feat: regenerate gapic'
5353
git push -f -u origin $BRANCH
54-
54+
5555
curl \
56-
-H "Authorization: Bearer ${INPUT_GITHUB_TOKEN}" \
57-
-H "Content-Type:application/json" \
58-
-X POST https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls \
59-
-d "{\"title\":\"GAPIC Client Update: ${INPUT_TARGET}\", \"body\": \"\", \"head\": \"$BRANCH\", \"base\": \"master\"}"
56+
-H "Authorization: Bearer ${INPUT_GITHUB_TOKEN}" \
57+
-H "Content-Type:application/json" \
58+
-X POST https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls \
59+
-d "{\"title\":\"GAPIC Client Update: ${INPUT_TARGET}\", \"body\": \"\", \"head\": \"$BRANCH\", \"base\": \"master\"}"
6060
fi
6161

6262
popd

0 commit comments

Comments
 (0)