Skip to content

Commit b1a0934

Browse files
committed
refactor: update build_packages to use GitHub App token for authentication
1 parent a571e9b commit b1a0934

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

build_packages

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ fi
1717
project=$1
1818
buildtype=$2
1919

20+
if [ -z "${GH_TOKEN:-}" ]; then
21+
echo "$0: GH_TOKEN (GitHub App token) is required but not set" >&2
22+
exit 66
23+
fi
24+
25+
echo "header=\"Authorization: Bearer ${GH_TOKEN}\"" > ~/.curlrc
26+
27+
# ensuring GH_TOKEN usage for clones/fetches
28+
git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
29+
2030
name=$(git config --get user.name)
2131
email=$(git config --get user.email)
2232
packager="${name} <${email}>"
@@ -52,7 +62,7 @@ while read -r line; do
5262
continue
5363
fi
5464
args+="run --rm -v ${outputdir}:/packages -v ${buildfilesdir}/deb:/buildfiles:ro "
55-
args+="-e GITHUB_TOKEN=${GITHUB_TOKEN} -e DEBFULLNAME='${name}' -e DEBEMAIL='${email}' "
65+
args+="-e GH_TOKEN=${GH_TOKEN} -e DEBFULLNAME='${name}' -e DEBEMAIL='${email}' "
5666
args+="citusdata/packaging:${os}-${release}-all $buildtype\n"
5767
elif [[ "${os}" = 'centos' ]] || [[ "${os}" = 'fedora' ]] || [[ "${os}" = 'oraclelinux' ]]; then
5868
# shellcheck source=/dev/null
@@ -78,13 +88,13 @@ while read -r line; do
7888
fi
7989
pgshort=${pgversion//./}
8090
args+="run --rm -v ${outputdir}:/packages -v ${buildfilesdir}/rpm:/buildfiles:ro "
81-
args+="-e GITHUB_TOKEN=${GITHUB_TOKEN} -e RPM_PACKAGER='${packager}' "
91+
args+="-e GH_TOKEN=${GH_TOKEN} -e RPM_PACKAGER='${packager}' "
8292
args+="citusdata/packaging:${os}-${release}-pg${pgshort} $buildtype\n"
8393
done
8494
elif [[ "${os}" = 'pgxn' ]]; then
8595
if [[ "${project}" = 'citus' ]] && [[ "${buildtype}" = 'release' ]]; then
8696
args+="run --rm -v ${outputdir}:/packages -v ${buildfilesdir}/pgxn:/buildfiles:ro "
87-
args+="-e GITHUB_TOKEN=${GITHUB_TOKEN} citusdata/packaging:${os}-all $buildtype\n"
97+
args+="-e GH_TOKEN=${GH_TOKEN} citusdata/packaging:${os}-all $buildtype\n"
8898
else
8999
echo "skipping PGXN... unsupported for this build" >&2
90100
fi

0 commit comments

Comments
 (0)