diff --git a/.github/scripts/action.yaml b/.github/scripts/action.yaml index f67f2a5229..b7904cb16d 100644 --- a/.github/scripts/action.yaml +++ b/.github/scripts/action.yaml @@ -33,6 +33,9 @@ inputs: showcase_mode: description: true if we need to download the showcase api definitions required: false + api_def_dir: + description: Path to api definitions (e.g. googleapis). Used when a custom set of protos is needed. + required: false token: description: Personal Access Token required: true @@ -76,10 +79,12 @@ runs: --target_branch "${BASE_REF}" \ --current_branch "${HEAD_REF}" \ --showcase_mode "${SHOWCASE_MODE}" \ + --api_def_dir "${API_DEF_DIR}" \ --image_tag "${IMAGE_TAG}" env: BASE_REF: ${{ inputs.base_ref }} HEAD_REF: ${{ inputs.head_ref }} IMAGE_TAG: ${{ inputs.image_tag }} SHOWCASE_MODE: ${{ inputs.showcase_mode }} + API_DEF_DIR: ${{ inputs.api_def_dir }} GH_TOKEN: ${{ inputs.token }} diff --git a/.github/scripts/hermetic_library_generation.sh b/.github/scripts/hermetic_library_generation.sh index 5da0e64c3a..3d9c04be95 100755 --- a/.github/scripts/hermetic_library_generation.sh +++ b/.github/scripts/hermetic_library_generation.sh @@ -50,6 +50,10 @@ case "${key}" in showcase_mode="$2" shift ;; + --api_def_dir) + api_def_dir="$2" + shift + ;; *) echo "Invalid option: [$1]" exit 1 @@ -92,12 +96,16 @@ git checkout "${current_branch}" git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}" # download api definitions from googleapis repository -googleapis_commitish=$(grep googleapis_commitish "${generation_config}" | cut -d ":" -f 2 | xargs) -api_def_dir=$(mktemp -d) -git clone https://github.com/googleapis/googleapis.git "${api_def_dir}" -pushd "${api_def_dir}" -git checkout "${googleapis_commitish}" -popd +if [[ -z "${api_def_dir}" ]];then + googleapis_commitish=$(grep googleapis_commitish "${generation_config}" | cut -d ":" -f 2 | xargs) + api_def_dir=$(mktemp -d) + git clone https://github.com/googleapis/googleapis.git "${api_def_dir}" + pushd "${api_def_dir}" + git checkout "${googleapis_commitish}" + popd +else + ls "${api_def_dir}/google/cloud/vertexai/v1" +fi # we also setup showcase if [[ "${showcase_mode}" == "true" ]]; then