Skip to content

Commit 11bd174

Browse files
committed
chore(scripts): add custom gh auth to release script
1 parent bc8126f commit 11bd174

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

scripts/release.sh

+12
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,18 @@ done
113113
# Check dependencies.
114114
dependencies gh jq sort
115115

116+
# Authenticate gh CLI.
117+
# NOTE: Coder external-auth won't work because the GitHub App lacks permissions.
118+
if [[ -z ${GITHUB_TOKEN:-} ]]; then
119+
if [[ -n ${GH_TOKEN:-} ]]; then
120+
export GITHUB_TOKEN=${GH_TOKEN}
121+
elif token="$(gh auth token --hostname github.com 2>/dev/null)"; then
122+
export GITHUB_TOKEN=${token}
123+
else
124+
error "GitHub authentication is required to run this command, please set GITHUB_TOKEN or run 'gh auth login'."
125+
fi
126+
fi
127+
116128
if [[ -z $increment ]]; then
117129
# Default to patch versions.
118130
increment="patch"

0 commit comments

Comments
 (0)