Skip to content

Commit bbe1f78

Browse files
authored
fix(ci): bootstrap the GitHub token if it's not already provided (#1085)
1 parent 04dd516 commit bbe1f78

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

shell/ci/release/docker-authn.sh

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
1313
AUTH_DIR="${DIR}/../auth"
1414
LIB_DIR="${DIR}/../../lib"
1515
DOCKER_AUTH_DIR="${LIB_DIR}/docker/authn"
16-
ROOT_DIR="${DIR}/../../.."
1716

1817
# shellcheck source=../../lib/logging.sh
1918
source "${LIB_DIR}/logging.sh"
@@ -24,15 +23,11 @@ source "${LIB_DIR}/mise.sh"
2423
# shellcheck source=../../lib/shell.sh
2524
source "${LIB_DIR}/shell.sh"
2625

27-
tool_version() {
28-
local tool="$1"
29-
grep "^$tool:" "$ROOT_DIR"/versions.yaml | awk '{print $2}'
30-
}
31-
3226
info "Ensuring that 'gh' is installed"
3327

34-
install_tool_with_mise github-cli "$(tool_version gh)"
35-
install_tool_with_mise gojq "$(tool_version gojq)"
28+
ensure_mise_installed
29+
devbase_configure_global_tools
30+
run_mise install --cd "$HOME" github-cli github:getoutreach/ci gojq
3631

3732
info "🔓 Authenticating to GitHub"
3833

shell/circleci/machine.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@ if [[ $OSTYPE == "darwin"* && -z ${ALLOW_MISE_TO_MANAGE_TOOL_VERSIONS:-} ]] || !
3636
install_tool_with_mise node "$(grep ^nodejs "$ROOT_DIR/.tool-versions" | awk '{print $2}')"
3737
fi
3838
run_mise trust --env devbase --cd "$ROOT_DIR"
39-
run_mise install --cd "$HOME" github-cli github:getoutreach/ci gojq
4039

41-
bootstrap_github_token
40+
if [[ -z $GITHUB_TOKEN ]]; then
41+
# Minimum amount of tools to install to bootstrap the GitHub token
42+
run_mise install --cd "$HOME" github-cli github:getoutreach/ci gojq
43+
44+
bootstrap_github_token
45+
46+
if [[ -z $GITHUB_TOKEN ]]; then
47+
fatal "GitHub token not configured in environment, needed for installing tools via mise."
48+
fi
49+
fi
4250

4351
info "Installing tools via mise required in machine environment"
4452
run_mise install --cd "$HOME"

versions.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
getoutreach/ci: v1.6.14
21
getoutreach/logfmt: v1.1.0
32

43
# protobuf formatters/plugins/tools/etc

0 commit comments

Comments
 (0)