xref: /aosp_15_r20/external/google-auth-library-java/.kokoro/readme.sh (revision af546375c95127f07cb26dd492629ccb2e8b1be1)
1#!/bin/bash
2# Copyright 2020 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16set -eo pipefail
17
18cd ${KOKORO_ARTIFACTS_DIR}/github/google-auth-library-java
19
20# Disable buffering, so that the logs stream through.
21export PYTHONUNBUFFERED=1
22
23# Kokoro exposes this as a file, but the scripts expect just a plain variable.
24export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key)
25
26# Setup git credentials
27echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials
28git config --global credential.helper 'store --file ~/.git-credentials'
29
30python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool
31
32set +e
33python3.6 -m autosynth.synth \
34    --repository=googleapis/google-auth-library-java \
35    --synth-file-name=.github/readme/synth.py \
36    --metadata-path=.github/readme/synth.metadata \
37    --pr-title="chore: regenerate README" \
38    --branch-suffix="readme"
39
40# autosynth returns 28 to signal there are no changes
41RETURN_CODE=$?
42if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]]
43then
44    exit ${RETURN_CODE}
45fi
46