mirror of
https://github.com/hashicorp/vault-action.git
synced 2026-05-13 21:35:53 +00:00
Some checks failed
* chore: upgrade Node.js to 24 and update dependencies - Upgrade Node.js from 20 to 24.15.0 across all CI jobs and workflows - Run npm audit fix to resolve CVEs in dependencies - Generate TLS certs dynamically via scripts/gen-tls-certs.sh instead of using static certs - Add Makefile targets for running each integration test suite locally * add GOPATH/bin to PATH before running gen-tls-certs.sh * Add changelog entry * refactor makefile * Refine e2e-enterprise pipeline and scripts
35 lines
908 B
Bash
35 lines
908 B
Bash
#!/usr/bin/env bash
|
|
# Copyright IBM Corp. 2019, 2025
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# Adapted from: https://github.com/hashicorp/vault-secrets-operator/blob/main/hack/.functions
|
|
|
|
# getGH downloads files from GitHub with optional authentication
|
|
# Usage: getGH <url> [dest_file] [num_retries]
|
|
function getGH() {
|
|
local url="$1"
|
|
local dest="$2"
|
|
local num_retries="${3:-${GH_GET_RETRIES}}"
|
|
|
|
headers=(
|
|
'--header' "Accept: application/vnd.github+json"
|
|
'--header' "X-GitHub-Api-Version: 2022-11-28"
|
|
)
|
|
if [ -n "${GITHUB_TOKEN}" ]; then
|
|
headers+=(
|
|
'--header' "Authorization: Bearer ${GITHUB_TOKEN}"
|
|
)
|
|
fi
|
|
cmd=curl
|
|
opts=('-sfSL')
|
|
echo "Fetching ${url}"
|
|
if [ -z "${dest}" ]; then
|
|
opts+=('-O')
|
|
else
|
|
opts+=('-o' "${dest}")
|
|
fi
|
|
if [ -n "${num_retries}" ]; then
|
|
opts+=('--retry' "${num_retries}")
|
|
fi
|
|
${cmd} "${opts[@]}" "${headers[@]}" "${url}"
|
|
}
|