File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,12 +47,33 @@ jobs:
4747 uses : shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
4848 with :
4949 php-version : ' 8.2'
50- tools : phive
5150 coverage : none
5251
53- - name : Download latest phpDocumentor
52+ - name : Download phpDocumentor
5453 working-directory : source
55- run : phive --no-progress install --trust-gpg-keys 6DA3ACC4991FFAE5 phpDocumentor
54+ env :
55+ GITHUB_TOKEN : ${{ github.token }}
56+ run : |
57+ curl_retry() {
58+ curl --fail --silent --show-error --location --retry 5 --retry-all-errors --retry-delay 5 "$@"
59+ }
60+
61+ asset=$(curl_retry \
62+ --header "Authorization: Bearer ${GITHUB_TOKEN}" \
63+ https://api.github.com/repos/phpDocumentor/phpDocumentor/releases/latest \
64+ | jq --compact-output '.assets[] | select(.name == "phpDocumentor.phar")')
65+
66+ url=$(jq --raw-output '.browser_download_url' <<< "${asset}")
67+ sha256=$(jq --raw-output '.digest | sub("^sha256:"; "")' <<< "${asset}")
68+
69+ if [ -z "${url}" ] || ! [[ "${sha256}" =~ ^[0-9a-f]{64}$ ]]; then
70+ echo "Could not resolve the phpDocumentor phar and its SHA-256 digest."
71+ exit 1
72+ fi
73+
74+ mkdir --parents tools
75+ curl_retry --output tools/phpDocumentor "${url}"
76+ echo "${sha256} tools/phpDocumentor" | sha256sum --check --strict
5677
5778 - name : Prepare API repo
5879 working-directory : api
You can’t perform that action at this time.
0 commit comments