File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,15 +88,20 @@ if [ -z "${pkglatest}" ]; then
8888 exit $noinput
8989fi
9090
91- if [ -z " ${ GH_TOKEN:- } " ] ; then
92- echo " $0 : GH_TOKEN (GitHub App token) is required but not set " >&2
93- exit 66
91+ # normalize token name (accept GH_TOKEN from CI) and fail fast — we only use installation tokens
92+ if [ -n " ${GH_TOKEN :- } " ] && [ -z " ${GITHUB_TOKEN :- } " ] ; then
93+ export GITHUB_TOKEN= " ${GH_TOKEN} "
9494fi
9595
96- echo " header=\" Authorization: Bearer ${GH_TOKEN} \" " > ~ /.curlrc
96+ if [ -z " ${GITHUB_TOKEN:- } " ]; then
97+ echo " $0 : error: GITHUB_TOKEN (installation token) is required" >&2
98+ exit $noinput
99+ fi
97100
98- # ensuring GH_TOKEN usage for clones/fetches
99- git config --global url." https://x-access-token:${GH_TOKEN} @github.com/" .insteadOf " https://github.com/"
101+ # use installation token for curl and git; keep token file permission-restricted
102+ printf ' header="Authorization: token %s"\n' " ${GITHUB_TOKEN} " > ~ /.curlrc
103+ chmod 600 ~ /.curlrc
104+ git config --global url." https://x-access-token:${GITHUB_TOKEN} @github.com/" .insteadOf " https://github.com/"
100105
101106export NAME
102107NAME=$( determine_name)
Original file line number Diff line number Diff line change @@ -50,15 +50,20 @@ if [ -z "${pkglatest}" ]; then
5050 exit $noinput
5151fi
5252
53- if [ -z " ${ GH_TOKEN:- } " ] ; then
54- echo " $0 : GH_TOKEN (GitHub App token) is required but not set " >&2
55- exit 66
53+ # normalize token name (accept GH_TOKEN from CI) and fail fast — we only use installation tokens
54+ if [ -n " ${GH_TOKEN :- } " ] && [ -z " ${GITHUB_TOKEN :- } " ] ; then
55+ export GITHUB_TOKEN= " ${GH_TOKEN} "
5656fi
5757
58- echo " header=\" Authorization: Bearer ${GH_TOKEN} \" " > ~ /.curlrc
58+ if [ -z " ${GITHUB_TOKEN:- } " ]; then
59+ echo " $0 : error: GITHUB_TOKEN (installation token) is required" >&2
60+ exit $noinput
61+ fi
5962
60- # ensuring GH_TOKEN usage for clones/fetches
61- git config --global url." https://x-access-token:${GH_TOKEN} @github.com/" .insteadOf " https://github.com/"
63+ # use installation token for curl and git; keep token file permission-restricted
64+ printf ' header="Authorization: token %s"\n' " ${GITHUB_TOKEN} " > ~ /.curlrc
65+ chmod 600 ~ /.curlrc
66+ git config --global url." https://x-access-token:${GITHUB_TOKEN} @github.com/" .insteadOf " https://github.com/"
6267
6368cp -R /buildfiles/META.json " ${builddir} "
6469repopath=" citusdata/${hubproj} "
Original file line number Diff line number Diff line change @@ -81,15 +81,20 @@ if [ -z "${pkglatest}" ]; then
8181 exit $noinput
8282fi
8383
84- if [ -z " ${ GH_TOKEN:- } " ] ; then
85- echo " $0 : GH_TOKEN (GitHub App token) is required but not set " >&2
86- exit 66
84+ # normalize token name (accept GH_TOKEN from CI) and fail fast — we only use installation tokens
85+ if [ -n " ${GH_TOKEN :- } " ] && [ -z " ${GITHUB_TOKEN :- } " ] ; then
86+ export GITHUB_TOKEN= " ${GH_TOKEN} "
8787fi
8888
89- echo " header=\" Authorization: Bearer ${GH_TOKEN} \" " > ~ /.curlrc
89+ if [ -z " ${GITHUB_TOKEN:- } " ]; then
90+ echo " $0 : error: GITHUB_TOKEN (installation token) is required" >&2
91+ exit $noinput
92+ fi
9093
91- # ensuring GH_TOKEN usage for clones/fetches
92- git config --global url." https://x-access-token:${GH_TOKEN} @github.com/" .insteadOf " https://github.com/"
94+ # use installation token for curl and git; keep token file permission-restricted
95+ printf ' header="Authorization: token %s"\n' " ${GITHUB_TOKEN} " > ~ /.curlrc
96+ chmod 600 ~ /.curlrc
97+ git config --global url." https://x-access-token:${GITHUB_TOKEN} @github.com/" .insteadOf " https://github.com/"
9398
9499name=$( determine_name)
95100email=$( determine_email)
You can’t perform that action at this time.
0 commit comments