Skip to content

Commit 4281e43

Browse files
mafredrikylecarbs
authored andcommitted
chore(scripts): add custom gh auth to release script (#13396)
(cherry picked from commit 5fb2317)
1 parent 66de7dd commit 4281e43

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/release.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,17 @@ done
113113
# Check dependencies.
114114
dependencies gh jq sort
115115

116-
# Authenticate gh CLI
117-
gh_auth
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
118127

119128
if [[ -z $increment ]]; then
120129
# Default to patch versions.

0 commit comments

Comments
 (0)