fix shellcheck issues

This commit is contained in:
Muhammad Atif Ali 2024-04-30 11:26:44 +00:00
parent 03f793c18d
commit db3aad76e1
2 changed files with 11 additions and 1 deletions

View File

@ -4,6 +4,7 @@
# [#pr-deployments](https://codercom.slack.com/archives/C05DNE982E8) Slack channel
set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
cdroot

View File

@ -133,7 +133,16 @@ requiredenvs() {
gh_auth() {
local fail=0
if [[ "${CODER:-}" == "true" ]]; then
export GITHUB_TOKEN=$(coder external-auth access-token github)
if ! output=$(coder external-auth access-token github 2>&1); then
log "ERROR: Could not authenticate with GitHub."
log "$output"
fail=1
else
GITHUB_TOKEN=$(coder external-auth access-token github)
export GITHUB_TOKEN
fi
else
log "Please authenticate gh CLI by running 'gh auth login'"
fi
}