diff --git a/get-gluon-branch.sh b/get-gluon-branch.sh
index 35e25f11615b950bf440aca0d755fbd60713b9e0..1ad4a4b87d3d7655c0a47452238395ed3a86eb38 100755
--- a/get-gluon-branch.sh
+++ b/get-gluon-branch.sh
@@ -6,25 +6,23 @@ set -o pipefail
 # autoupdater
 # ====
 #
-# For commit builds, the autoupdater shall be off, i.e. GLUON_BRANCH unset.
-# For nightly, GLUON_BRANCH must be nightly.
-# For beta, GLUON_BRANCH must be beta.
-# For stable, GLUON_BRANCH must be stable.
-
-gluon_branch=""
+# This script prints the name of the autoupdater branch depending on the build
+# configuration. Its output is suitable for use as the GLUON_BRANCH build
+# variable of gluon.
+#
+# The idea is to take whatever comes in the GLUON_BRANCH build variable,
+# except when this value is not one of the well-known branch names; then fall
+# back to 'nightly'.
 
-if [[ "${CI_PIPELINE_SOURCE:-}" = "schedule" ]]; then
-    gluon_branch="nightly"
-fi
+default_gluon_branch_name="nightly"
 
-case "${CI_COMMIT_TAG:-}" in
-beta/*)
-    gluon_branch="beta"
-;;
-stable/*)
-    gluon_branch="stable"
-;;
+case "${GLUON_BRANCH:-}" in
+    "nightly" | "beta" | "stable")
+        gluon_branch="$GLUON_BRANCH"
+        ;;
+    *):
+        gluon_branch="$default_gluon_branch_name"
+        ;;
 esac
 
-# Else: Commit build
 echo $gluon_branch